500 likes | 1.53k Views
Simula Programming Language. Lenar Uri T. Barcelona. It all started with a need…. Kristen Nygaard realized, through his work in the Norwegian Defense Research Establishment, that there is a need for simulation tools. It all started with a need….
E N D
Simula Programming Language Lenar Uri T. Barcelona
It all started with a need… • Kristen Nygaard realized, through his work in the Norwegian Defense Research Establishment, that there is a need for simulation tools
It all started with a need… • Nygaard left NDRE and put up NCC (Norwegian Computing Center) where, similar to his previous job, he realized that there is a need for simulation tools
Summer 1961-Fall 1962 The concept of a mathematical discrete event network and programming language reasoning for Simula I were developed by Nygaard and Dahl Fall 1962-September 1963 It was decided that Simula I would be implemented as a simulation procedure package along with a preprocessor to Algol 60 History of Simula
September 1963 - March 1964 A new storage management scheme Simula I would be implemented through a modification and extension of Univac's Algol 60 compiler March 1964-December 1964 The first prototype was completed in December Minor language modifications were made Extensions based on implementation experience and programming test cases were completed History of Simula
Fall of 1965 The Technical University of Norway wanted to implement a new Algol 60 compiler on the Univac 1100 series Nygaard and Dahl determined that attribute accessing and common properties of processes were the most significant problems in Simula I December 1966 Prefixing Today, prefixing is known as inheritance Class Concept Prefixing can be extended to include multiple prefixing thus establishing hierarchies of process classes This led to the idea of objects History of Simula
Classes Objects instance variables methods Inheritance Sub-typing “Inner” supports method combination "Virtual" methods methods that can be redefined in derived classes Inspect/QUA run-time class (type) tests Encapsulation "Protected" which means that they are accessible for subclasses "Hidden" in which case that are not accessible to subclasses either Features of Simula
Extensions/Modifications of Algol 60 • Added: • Class concepts and reference-variables (pointers to objects) • Pass-by-reference • Char, Text, and I/O • Co-routines • Removed: • Changed default parameter passing mechanism from call-by-name to pass-by-value • Pass-by-result • Some variable initialization requirements • String type (in favor of "text" type)
Language features: Limited file access facilities Missing data types (records, sets) No real time support No GUI support Long executable files for short programs OOP features: No multiple inheritance No interfaces Simulation: No automatic collection of statistics No report generator No specialized facilities Problems with Simula
Implicit conversion is performed, where necessary, each time a term-operator-term triple is evaluated General Rules If the operator is integer divide, //, both terms must be integer or short integer; use of reals or long reals constitutes a runtime error Implicit Conversion
All short integer values are converted to integer; this can never cause a conversion error If the operator is real divide, /, both terms are converted to real or long real, in accordance with (4) Where the terms are of different types and at least one is real or long real conversion is performed; if one term is long real the other is converted to long real otherwise the non-real term is converted to real Implicit Conversion
Syntax Rules - Blocks begin comment Our first SIMULA program; integer Count; count := 3; OutInt(Count,4); OutImage end
Syntax Rules - Declarations procedure PrintTimes(T1, count); text T1; integer count;begin integer i; i := 0; while i < count do begin OutText(T1); OutImage; end;end;
Syntax Rules - Declarations class HelloWorld;begin text outPut; outPut :- "Hello World"; procedure sayHello; begin OutText(outPut); end;end;
Syntax Rules - Recursion begin procedure factorial(m); integer m; begin if m > 0 then begin factorial := m * factorial(m-1); end; else factorial := 1; end; OutInt(factorial(5),4);end
Syntax Rules – if then else integer count, countAgain; count := 2; countAgain := 3; if count = 2 then begin if countAgain = 3 then OutText("I will be printed"); end;
Syntax Rules - while integer count; count := 0; while count < 10 do begin OutInt(count, 4); OutImage; count := count + 1; end;