Recent from talks
Nothing was collected or created yet.
Simula
View on Wikipedia| Simula | |
|---|---|
| Paradigms | Multi-paradigm: procedural, imperative, structured, object-oriented |
| Family | ALGOL |
| Designed by | Ole-Johan Dahl |
| Developer | Kristen Nygaard |
| First appeared | 1962 |
| Stable release | Simula 67, Simula I
|
| Typing discipline | Static, nominative |
| Scope | Lexical |
| Implementation language | ALGOL 60 (mostly) SIMSCRIPT (some parts) |
| OS | Unix-like, Windows, z/OS, TOPS-10, MVS |
| Website | www |
| Influenced by | |
| ALGOL 60, SIMSCRIPT | |
| Influenced | |
| BETA, CLU, Eiffel, Emerald, Pascal, Smalltalk, C++, and many other object-oriented programming languages | |
Simula is the name of two simulation programming languages, Simula I and Simula 67, developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole-Johan Dahl and Kristen Nygaard. Syntactically, it is an approximate superset of ALGOL 60, [1]: 1.3.1 and was also influenced by the design of SIMSCRIPT.[2][3]
Simula 67 introduced objects,[1]: 2, 5.3 classes,[1]: 1.3.3, 2 inheritance, subclasses[1]: 2.2.3 and an implementation of the polymorphism,[1]: 1.3.3 virtual procedures,[1]: 2.2.3 coroutines,[1]: 9.2 and discrete event simulation,[1]: 14.2 and featured garbage collection.[1]: 9.1 Other forms of subtyping (besides inheriting subclasses) were introduced in Simula derivatives.[citation needed]
Simula is considered the first object-oriented programming language. As its name suggests, the first Simula version by 1962 was designed for doing simulations; Simula 67 though was designed to be a general-purpose programming language[4] and provided the framework for many of the features of object-oriented languages today.
Simula has been used in a wide range of applications such as simulating very-large-scale integration (VLSI) designs, process modeling, communication protocols, algorithms, and other applications such as typesetting, computer graphics, and education.
Computer scientists such as Bjarne Stroustrup, creator of C++, and James Gosling, creator of Java, have acknowledged Simula as a major influence.[5] Simula-type objects are reimplemented in C++, Object Pascal, Java, C#, and many other languages.
History
[edit]The following account is based on Jan Rune Holmevik's historical essay.[6][7][8][9]
Kristen Nygaard started writing computer simulation programs in 1957. Nygaard saw a need for a better way to describe the heterogeneity and the operation of a system. To further develop his ideas for a computer language to describe a system, Nygaard realized that he needed someone with more computer programming skills than he had. Ole-Johan Dahl joined him on his work in January 1962. Shortly after, the decision was made to link the language to ALGOL 60. By May 1962, the main concepts for a simulation language were established; SIMULA I, a specialized programming language designed for simulating discrete event systems, was born.
Kristen Nygaard was invited to visit the Eckert–Mauchly Computer Corporation in late May 1962 in connection with the marketing of their new UNIVAC 1107 computer. At that visit, Nygaard presented the ideas of Simula to Robert Bemer, the director of systems programming at Univac. Bemer was a great ALGOL fan and found the Simula project compelling. Bemer was also chairperson of a session at the second international conference on information processing hosted by International Federation for Information Processing (IFIP). He invited Nygaard, who presented the paper "SIMULA – An Extension of ALGOL to the Description of Discrete-Event Networks".
The Norwegian Computing Center got a UNIVAC 1107 in August 1963 at a considerable discount, on which Dahl implemented the SIMULA I under contract with UNIVAC. The implementation was based on the UNIVAC ALGOL 60 compiler. SIMULA I was fully operational on the UNIVAC 1107 by January 1965. In the following few years, Dahl and Nygaard spent a lot of time teaching Simula. Simula spread to several countries around the world and SIMULA I was later implemented on other computers including the Burroughs B5500 and the Russian Ural-16.
In 1966 C. A. R. Hoare introduced the concept of record class construct, which Dahl and Nygaard extended with the concept of prefixing and other features to meet their requirements for a generalized process concept. Dahl and Nygaard presented their paper on class and subclass declarations at the IFIP Working Conference on simulation languages in Oslo, May 1967. This paper became the first formal definition of Simula 67. In June 1967, a conference was held to standardize the language and initiate a number of implementations. Dahl proposed to unify the type and the class concept. This led to serious discussions, and the proposal was rejected by the board. Simula 67 was formally standardized on the first meeting of the Simula Standards Group (SSG) in February 1968.

Simula was influential in the development of Smalltalk and later object-oriented programming languages. It also helped inspire the actor model of concurrent computation although Simula only supports coroutines and not true concurrency.[10]
In the late sixties and the early seventies, there were four main implementations of Simula:
- UNIVAC 1100 by Norwegian Computing Center (NCC)
- System/360 and System/370 by NCC
- CDC 3000 by University of Oslo's Joint Computer Installation at Kjeller
- TOPS-10 by Swedish National Defence Research Institute (FOA)
These implementations were ported to a wide range of platforms. The TOPS-10 implemented the concept of public, protected, and private member variables and procedures, that later was integrated into Simula Standard in 1986.
Simula Standard 1986 is the latest standard and is ported to a wide range of platforms. There are mainly four implementations:
In November 2001, Dahl and Nygaard were awarded the IEEE John von Neumann Medal by the Institute of Electrical and Electronics Engineers "For the introduction of the concepts underlying object-oriented programming through the design and implementation of SIMULA 67". In April 2002, they received the 2001 A. M. Turing Award by the Association for Computing Machinery (ACM), with the citation: "For ideas fundamental to the emergence of object oriented programming, through their design of the programming languages Simula I and Simula 67." Dahl and Nygaard died in June and August of that year, respectively,[13] before the ACM Turing Award Lecture[14] that was scheduled to be delivered at the November 2002 OOPSLA conference in Seattle.
Simula Research Laboratory is a research institute named after the Simula language, and Nygaard held a part-time position there from the opening in 2001. The new Computer Science building at the University of Oslo is named Ole Johan Dahl's House, in Dahl's honour, and the main auditorium is named Simula.
Sample code
[edit]Minimal program
[edit]The empty computer file is the minimal program in Simula, measured by the size of the source code. It consists of one thing only; a dummy statement.
However, the minimal program is more conveniently represented as an empty block:
Begin End;
It begins executing and immediately terminates. The language lacks any return value from the program.
Classic Hello world
[edit]An example of a Hello world program in Simula:
Begin
OutText ("Hello, World!");
Outimage;
End;
Simula is case-insensitive.
Classes, subclasses and virtual procedures
[edit]A more realistic example with use of classes,[1]: 1.3.3, 2 subclasses[1]: 2.2.1 and virtual procedures:[1]: 2.2.3
Begin
Class Glyph;
Virtual: Procedure print Is Procedure print;;
Begin
End;
Glyph Class Char (c);
Character c;
Begin
Procedure print;
OutChar(c);
End;
Glyph Class Line (elements);
Ref (Glyph) Array elements;
Begin
Procedure print;
Begin
Integer i;
For i:= 1 Step 1 Until UpperBound (elements, 1) Do
elements (i).print;
OutImage;
End;
End;
Ref (Glyph) rg;
Ref (Glyph) Array rgs (1 : 4);
! Main program;
rgs (1):- New Char ('A');
rgs (2):- New Char ('b');
rgs (3):- New Char ('b');
rgs (4):- New Char ('a');
rg:- New Line (rgs);
rg.print;
End;
The above example has one super class (Glyph) with two subclasses (Char and Line). There is one virtual procedure with two implementations. The execution starts by executing the main program. Simula lacks the concept of abstract classes, since classes with pure virtual procedures can be instantiated. This means that in the above example, all classes can be instantiated. Calling a pure virtual procedure will however produce a run-time error.
Call by name
[edit]Simula supports call by name[1]: 8.2.3 so the Jensen's Device can easily be implemented. However, the default transmission mode for simple parameter is call by value, contrary to ALGOL which used call by name. The source code for the Jensen's Device must therefore specify call by name for the parameters when compiled by a Simula compiler.
Another much simpler example is the summation function which can be implemented as follows:
Real Procedure Sigma (k, m, n, u); Name k, u; Integer k, m, n; Real u; Begin Real s; k:= m; While k <= n Do Begin s:= s + u; k:= k + 1; End; Sigma:= s; End;
The above code uses call by name for the controlling variable (k) and the expression (u).
This allows the controlling variable to be used in the expression.
Note that the Simula standard allows for certain restrictions on the controlling variable in a for loop. The above code therefore uses a while loop for maximum portability.
The following:
can then be implemented as follows:
Z:= Sigma (i, 1, 100, 1 / (i + a) ** 2);
Simulation
[edit]Simula includes a simulation[1]: 14.2 package for doing discrete event simulations. This simulation package is based on Simula's object-oriented features and its coroutine[1]: 9.2 concept. Simula also was used for simulation proposes using procedural generation to generate pseudo-random numbers.[1]: 12.1
Sam, Sally, and Andy are shopping for clothes. They must share one fitting room. Each one of them is browsing the store for about 12 minutes and then uses the fitting room exclusively for about three minutes, each following a normal distribution. A simulation of their fitting room experience is as follows:
Simulation Begin
Class FittingRoom; Begin
Ref (Head) door;
Boolean inUse;
Procedure request; Begin
If inUse Then Begin
Wait (door);
door.First.Out;
End;
inUse:= True;
End;
Procedure leave; Begin
inUse:= False;
Activate door.First;
End;
door:- New Head;
End;
Procedure report (message); Text message; Begin
OutFix (Time, 2, 0); OutText (": " & message); OutImage;
End;
Process Class Person (pname); Text pname; Begin
While True Do Begin
Hold (Normal (12, 4, u));
report (pname & " is requesting the fitting room");
fittingroom1.request;
report (pname & " has entered the fitting room");
Hold (Normal (3, 1, u));
fittingroom1.leave;
report (pname & " has left the fitting room");
End;
End;
Integer u;
Ref (FittingRoom) fittingRoom1;
fittingRoom1:- New FittingRoom;
Activate New Person ("Sam");
Activate New Person ("Sally");
Activate New Person ("Andy");
Hold (100);
End;
The main block is prefixed with Simulation for enabling simulation. The simulation package can be used on any block and simulations can even be nested when simulating someone doing simulations.
The fitting room object uses a queue (door) for getting access to the fitting room. When someone requests the fitting room and it's in use they must wait in this queue (Wait (door)). When someone leaves the fitting room the first one (if any) is released from the queue (Activate door.first) and accordingly removed from the door queue (door.First.Out).
Person is a subclass of Process and its activity is described using hold (time for browsing the store and time spent in the fitting room) and calls procedures in the fitting room object for requesting and leaving the fitting room.
The main program creates all the objects and activates all the person objects to put them into the event queue. The main program holds for 100 minutes of simulated time before the program terminates.
Notes
[edit]- ^ a b c d e f g h i j k l m n o p Dahl, Ole-Johan; Myhrhaug, Bjørn; Nygaard, Kristen (1970). Common Base Language (PDF) (Report). Norwegian Computing Center. Archived from the original on 2024-09-19. Retrieved 20 August 2025.
- ^ Nygaard, Kristen (1978). "The Development of the Simula Languages" (PDF).
The development of .. SIMULA I and SIMULA 67... were influenced by the design of SIMSCRIPT ...
- ^ Dahl, Ole-Johan; Myhrhaug, Bjørn; Nygaard, Kristen (1970). Simula: A language for programming and description of discrete event systems introduction and user's manual (PDF) (Report). Norwegian Computing Center. Archived from the original on 2025-08-23. Retrieved 29 October 2025.
- ^ Kristen Nygaard and Ole-Johan Dahl. 1978. The development of the SIMULA languages. History of programming languages. Association for Computing Machinery, New York, NY, USA, 439–480. DOI:https://doi.org/10.1145/800025.1198392
- ^ Wong, William. "Before C, What Did You Use?". Electronic Design. Retrieved 22 May 2017.
- ^ Holmevik, Jan Rune (1994). "Compiling Simula: A historical study of technological genesis" (PDF). IEEE Annals of the History of Computing. 16 (4): 25–37. doi:10.1109/85.329756. S2CID 18148999. Retrieved 12 May 2010.
- ^ Holmevik, Jan Rune. "Compiling Simula". Oslo, Norway: Institute for Studies in Research and Higher Education. Archived from the original on 20 April 2009. Retrieved 19 April 2017.
- ^ Holmevik, Jan Rune. "The History of Simula". Oslo, Norway: Institute for Studies in Research and Higher Education. Archived from the original on 27 October 2025. Retrieved 27 October 2025.
- ^ Holmevik, Jan Rune. "The Simula programming language". Oslo, Norway: University of Oslo. Archived from the original on 27 October 2025. Retrieved 27 October 2025.
- ^ Lehrmann Madsen, Ole (2014). "Building Safe Concurrency Abstractions". In Agha, Gul; Igarashi, Atsushi; Kobayashi, Naoki; Masuhara, Hidehiko; Matsuoka, Satoshi; Shibayama, Etsuya; Taura, Kenjiro (eds.). Concurrent Objects and Beyond. Lecture Notes in Computer Science. Vol. 8665. Berlin: Springer. p. 68. doi:10.1007/978-3-662-44471-9. ISBN 978-3-662-44471-9. S2CID 1000741.
- ^ "GNU Cim".
- ^ "Portable Simula Revisited". GitHub. Retrieved 17 June 2019.
- ^ "ACM Ole-Johan Dahl and Kristen Nygaard - Obituary". Acm.org. Archived from the original on 19 July 2011. Retrieved 14 January 2012.
- ^ "ACM Turing Award Lectures". Informatik.uni-trier.de. Retrieved 14 January 2012.
Sources
[edit]- Sylvester, Peter. "IBM System 360/370 Compiler and Historical Documentation" (The Simula Standard and other historical documentation).
Further reading
[edit]- Pooley, Rob (1987), An Introduction to Programming in Simula, Alfred Waller Ltd, ISBN 0632016116, archived from the original on 2004-09-19
External links
[edit]Simula
View on GrokipediaHistory
Development origins
Simula's development originated at the Norwegian Computing Center (NCC) in Oslo, Norway, where the project was initiated in spring 1961 to address pressing needs in simulation programming for operations research. The primary motivation stemmed from the challenges of modeling complex systems, particularly in industrial and economic contexts, where existing tools fell short in handling discrete event simulations efficiently.[5] This effort was driven by the recognition that simulation languages required more flexible structures for describing dynamic processes, building on the limitations observed in earlier Monte Carlo methods and general-purpose languages.[4] The language was conceived as an extension of ALGOL 60, leveraging its block structure and programming security to ensure compatibility and broad appeal among European researchers. The initial focus centered on discrete event simulation, enabling the modeling of sequential processes in areas like production planning and resource allocation, which were critical for operations research applications in industry and economics. This approach allowed Simula to go beyond mere numerical computation, incorporating concepts for system description that facilitated both simulation and analysis of real-world scenarios.[1] Early prototypes emerged as Simula I between 1964 and 1965, initially implemented under a contract for the UNIVAC 1100 series to support simulation tasks. This version marked the first operational form of the language, emphasizing its utility in process simulations for control and planning. A notable early application occurred in 1965, when Simula I was used for shipyard planning simulations, demonstrating its practical effectiveness in optimizing industrial workflows through discrete event modeling.[5]Key contributors and milestones
The development of Simula was primarily led by Ole-Johan Dahl and Kristen Nygaard at the Norwegian Computing Center (NCC) in Oslo, where they conceived and designed the language as an extension of ALGOL 60 for simulation purposes.[3] Dahl, who joined NCC in 1963 after earlier work in software development at the Norwegian Defence Research Establishment (NDRE), focused on implementing core concepts like the process mechanism, while Nygaard joined NCC in 1960 and became its Director of Research in 1962, driving the initial vision for a simulation language.[4] Their collaboration built on foundational influences from Jan V. Garwick, a pioneer in Norwegian informatics who mentored both at NDRE in the 1950s, contributing early ideas on computing systems and garbage collection that informed Simula's runtime features.[4] A key milestone occurred in early 1965, when the first Simula I compiler was completed for the Univac 1107 system, enabling practical use in simulation modeling.[4] This culminated in the public demonstration of Simula I at the IFIP Congress in New York from May 24 to 29, 1965, where Dahl and Nygaard presented results from a real-life simulation model, marking the language's debut and gaining international attention for its innovative approach to discrete event simulation.[4] Building on Simula I, the team advanced to Simula 67 in 1966–1967, generalizing the language into a full programming system with class concepts for broader applicability.[4] Simula 67 was officially introduced by Dahl and Nygaard at the IFIP TC 2 Working Conference on Simulation Languages in Lysebu, near Oslo, from May 22 to 26, 1967, followed by the publication of the "SIMULA 67 Common Base Proposal" report in May 1967, which outlined the standardized core features required for all implementations.[6] This report, issued by the Norwegian Computing Center, established Simula 67 as a portable, extensible language and laid the groundwork for the formal Common Base definition later refined in 1968.[4] In recognition of their pioneering work on Simula, which introduced fundamental object-oriented programming concepts such as classes, objects, and inheritance, Dahl and Nygaard received the A.M. Turing Award in 2001 from the Association for Computing Machinery.[3] The award citation specifically credited their design of Simula I and Simula 67 for ideas essential to the emergence of object-oriented programming.[7]Standardization as Simula 67
The development of Simula 67 marked a pivotal transition from the earlier Simula I, which was primarily a simulation language implemented between 1963 and 1965 on the UNIVAC 1107 at the Norwegian Computing Center (NCC). Starting in 1965, efforts focused on refining the language to address limitations such as inefficient storage management and cumbersome element-set interactions, evolving it into a general-purpose programming language with full object-oriented capabilities. By 1967, the introduction of the class concept enabled the definition of objects encapsulating both data and procedures, supporting inheritance through subclasses and establishing Simula as the first language to implement comprehensive object-oriented programming (OOP).[4] This standardization culminated in the official report "SIMULA 67 Common Base Language," authored by Ole-Johan Dahl, Bjørn Myhrhaug, and Kristen Nygaard at the NCC, with the initial definition finalized in June 1967 following the Simula 67 Common Base Conference held June 5 to 9 at the NCC. The report precisely defined the language's grammar and semantics, serving as the foundational specification for all subsequent implementations and ensuring portability across diverse systems. Established by the newly formed SIMULA Standards Group (SSG) in June 1967, with the Common Base formally approved at its first meeting in February 1968, it underwent minor revisions, such as the addition of string handling and input/output facilities by April 1968, to broaden its applicability beyond simulation.[4][8] Key refinements in Simula 67 included the integration of coroutines to facilitate discrete-event simulation, achieved through statements like "detach" and "resume" that allowed quasi-parallel execution of independent processes within a simulation environment. Additionally, prefix notation was introduced for blocks and classes, enabling concise hierarchical declarations—such as prefixing a "block" with a class to inherit its properties—while maintaining ALGOL 60 compatibility for control structures. These changes enhanced modularity and expressiveness, with coroutines supporting dynamic process activation and prefixing promoting reusable abstractions without altering the core block structure.[8][4] Adoption accelerated following the SSG's inaugural meeting in February 1968, where the Common Base was formally frozen, leading to implementations on major systems like the CDC 6600 and IBM 360 by 1968. The group, initially comprising NCC representatives and international collaborators such as those from Control Data Corporation, oversaw compliance and extensions, fostering widespread use in Nordic research projects and early software engineering efforts. By 1968, user communities began forming, exemplified by the SSG's role in coordinating the Nordic Simula Users Group, which promoted the language through conferences and shared resources.[4][8]Design principles
Object-oriented foundations
Simula introduced the class as the foundational construct in programming languages, serving as a unified mechanism that encapsulates both data attributes and associated procedures, now commonly referred to as methods. This innovation allowed for the creation of modular, self-contained units that model real-world entities by bundling state and behavior, marking a departure from purely procedural paradigms like ALGOL 60. In Simula 67, a class declaration defines a blueprint specifying local data (via type declarations) and procedures that operate on that data, enabling the construction of complex systems through composition rather than global variables and separate functions.[5] Classes in Simula function as templates for generating objects, where each object is an independent instance with its own data space. Instantiation occurs dynamically using thenew keyword, which allocates memory for the object and initializes it according to the class specification, returning a reference to the newly created entity. This approach supports runtime creation of multiple objects from the same class, each maintaining autonomy while sharing the common structure and behavior defined in the template. The mechanism ensures that objects can be referenced and manipulated indirectly, facilitating flexible program architectures without fixed compile-time structures.[5][1]
To achieve polymorphism, Simula incorporated virtual procedures, which enable late binding of method calls based on the actual type of the object at runtime rather than the reference type. A procedure declared as virtual within a class allows subclasses to override it, ensuring that the appropriate implementation is invoked dynamically during execution. This semi-dynamic binding resolves the procedure call to the version defined in the object's specific class, promoting extensibility and reuse across class hierarchies. Virtual procedures thus provide the core enabler for polymorphic behavior, where objects of different classes can be treated uniformly through a common interface.[5][1]
The prefix form in Simula's class activation further supports nested hierarchies by allowing one class to be prefixed to another, effectively creating a subclass that inherits all data and procedures from the prefix class while adding or modifying its own. This prefixing mechanism activates the base class's context during the subclass's definition and instantiation, enabling layered abstractions where inner classes operate within the scope of outer ones. Such nesting facilitates the construction of deep, organized class structures, with each level building upon the previous to form increasingly specialized object types. For instance, inheritance via prefixing allows brief extensions of base classes, as explored in subsequent examples of class definitions.[5]
Simulation-oriented features
Simula's simulation-oriented features were designed to facilitate discrete event simulation and process modeling, enabling the representation of dynamic systems through interacting entities without requiring true hardware parallelism. Central to this is the use of coroutines, implemented via theProcess class, which allows multiple processes to execute quasi-concurrently by interleaving their active phases. A process object can detach from the main execution chain using the detach statement, suspending its execution until reactivated, thus simulating concurrent activities in a single-threaded environment. This coroutine mechanism supports the modeling of independent yet interacting components, such as in system dynamics where processes represent entities like customers or machines.[8][4]
Discrete event simulation in Simula advances time through event-driven mechanisms, primarily the hold and wait statements within the Process class. The hold(T) statement passivates the current process and schedules its resumption after a delay of T time units along the simulation's time axis, effectively advancing the global simulation time to the next event. Meanwhile, wait(S) passivates the process and inserts it into an ordered set S, typically a queue representing a resource contention point, where it remains until explicitly reactivated via an activate or resume statement. These statements ensure that simulation time progresses only when events occur, avoiding unnecessary computation during idle periods.[8][1]
The built-in Simulation and Process classes provide foundational support for event management and resource handling. The Simulation class, which extends the Simset class for two-way linked lists, establishes a global time axis and the sequencing set (SQS)—an event queue implemented as a priority-ordered Simset where event notices are ranked by their EVTIME attribute. The Process class, defined as a subclass of link within the Simulation class and incorporating coroutine capabilities, equips objects with properties for managing active phases, event notices, and states (active, passive, suspended, or terminated). Together, they enable efficient event queue operations, such as inserting and extracting processes based on simulation time, facilitating resource management through queue-like structures.[8]
These features found practical application in modeling system dynamics, particularly in industrial simulations involving queues, servers, and entity interactions. For instance, in simulations of manufacturing environments, such as ASEA's job shop models or paper mill lumber yards, processes could represent jobs or materials queuing for servers (resources), using wait to handle contention and hold to model processing times, thereby analyzing throughput and bottlenecks with high fidelity. This approach allowed for scalable representations of complex interactions, influencing subsequent simulation languages and tools in operations research.[4][1]
Innovative mechanisms like call-by-name
One of Simula's key innovations in parameter passing is the support for call-by-name, an optional mechanism for procedure parameters that evaluates the actual argument only when the formal parameter is referenced during procedure execution.[8] This approach, inherited and adapted from ALGOL 60, performs a textual substitution of the actual parameter expression into the procedure body, allowing it to be re-evaluated dynamically each time it is used, which contrasts with call-by-value where the argument is evaluated once at the point of the call and a copy is passed.[8] In practice, this enables lazy evaluation, where computations are deferred until necessary, and facilitates higher-order functions by treating expressions as substitutable units rather than fixed values.[9] The implementation of call-by-name in Simula relies on generating thunks—small procedures that encapsulate the actual argument expression and its evaluation environment—for each formal parameter specified in this mode.[10] Upon each reference to the formal parameter within the procedure, the corresponding thunk is invoked to compute and return the current value of the expression, ensuring that side effects or changes in the caller's context are reflected accurately.[10] This thunk-based mechanism, while computationally expensive due to repeated evaluations and the overhead of thunk creation and invocation, provides significant flexibility for expressing complex simulation scenarios where parameters might represent dynamic conditions or event-driven computations.[11] Beyond parameter passing, Simula introduced detached tasks as a mechanism for independent process execution, allowing objects instantiated from classes to operate in a quasi-parallel manner decoupled from the main control flow.[4] A task becomes detached via thedetach statement, transitioning to an autonomous state managed by its local sequence control, while the overall simulation progresses through a central event queue; resumption occurs explicitly with resume on the object reference, enabling coroutine-like behavior for modeling concurrent activities without true parallelism.[4] This feature supports flexible simulation expressions by permitting tasks to suspend, resume, and interact via shared data structures, though it introduces overhead in storage management and sequencing to maintain block-structured scoping.[1]
Language syntax and semantics
Basic program structure
Simula programs are organized using a block structure inherited from ALGOL 60, where the main program forms a primary block consisting of a declaration section followed by a statement sequence.[8] This structure allows for modular decomposition, with blocks serving as self-contained units that encapsulate local declarations and executable statements, supporting nested hierarchies for complex programs.[12] The main block typically operates at the system level, initiating execution as a detached object in a quasi-parallel environment.[8] The outer block syntax employs the keywords begin and end to delimit the scope of declarations and statements, ensuring clear boundaries for visibility and execution.[12] Declarations precede statements within the block head, including type specifications for variables such as integers or references, while the body contains the sequence of statements to be executed sequentially.[8] Blocks may be prefixed by class declarations to integrate predefined functionality, such as input/output handling via the BasicIO class.[12] For control flow, Simula provides labels—defined as identifiers followed by a colon—and unconditional go to statements, which transfer execution to a labeled point within the same block instance.[8] However, these unstructured mechanisms are discouraged in favor of structured alternatives like conditional statements and loops, aligning with the language's foundational role in promoting disciplined programming practices.[13] Compilation units in Simula consist of separate blocks or class definitions that can be compiled independently, with the main program block linked to external classes via declarations such as external class.[12] This modularity allows programs to incorporate reusable components, such as simulation classes, while maintaining the overall structure as a cohesive prefixed block, often enclosed within a standard prefix like BASICIO for runtime support.[8]Data types and control flow
Simula supports a set of primitive data types that form the foundation for its expressions and variables, including integer, real, Boolean, and text types. The integer type represents whole numbers, including positive, negative, and zero values, with an optional short integer subtype that may be implemented as a subrange of the full integer type depending on the compiler. Real numbers are handled by the real type for standard floating-point values, with an optional long real subtype for higher precision, also implementation-defined. The Boolean type accommodates only the values true and false, serving as the basis for logical operations and conditions. Text, used for character strings, is an ordered sequence of characters that can be empty, with attributes like length accessible via dot notation (e.g., T.length), and initialized to notext.[8][14] Arrays in Simula are declared with a specified type and bounds, enabling multi-dimensional subscripted variables, such as[integer](/page/Integer) array A(1:10), where bounds checking occurs at runtime to prevent access errors outside the defined range. References, functioning as pointers to objects, are declared with a qualification like ref(ClassName), holding either a specific object or the special value none to indicate no object; they allow dynamic linking in simulations but require compatibility checks for assignments, such as ensuring subclass relationships. Simula employs static type checking where possible, enforcing strong typing by requiring exact type matches for assignments and operations, though implicit conversions are permitted among arithmetic types (e.g., integer to real) and explicit conversions via built-in procedures like entier for real to integer; references introduce some flexibility but trigger runtime errors for invalid assignments.[8][14]
Control flow in Simula is managed through standard conditional and iterative constructs derived from ALGOL influences, providing structured programming capabilities. The if-then-else statement evaluates a Boolean expression to selectively execute one of two statements, with syntax if Boolean-expression then statement [else statement], where the else clause is optional; for example, if x > 0 then y := 1 else y := 0. The while-do loop repeats a statement as long as a Boolean condition holds, equivalent to a labeled if-then-goto structure for implementation, as in while Boolean-expression do statement. For loops offer versatile iteration, assigning values to a simple variable via a for-right-part such as for i := 1 step 1 until n do statement, supporting value lists, steps, and until clauses for controlled repetition over ranges or collections.[8][14]
Switch statements facilitate selection based on an integer subscript, declared as switch switch-identifier := switch-list, where the list contains designational expressions (labels or procedure calls) indexed from 1, allowing goto-like transfers without direct labels; for instance, switch s := L1, L2, Q(5) selects based on s(2). Conditional expressions embed if-then-else logic within expressions, yielding a value of the common type between alternatives, such as if x > 0 then 1 else 0.0, with type promotion to long real if either branch requires it to ensure consistency. These mechanisms support precise control in simulation models, where loops and conditions often manage event sequencing.[8][14]
Procedures and expressions
In Simula, procedures are defined using a syntax that closely resembles that of ALGOL 60, with the declaration beginning with the keywordprocedure followed by the procedure identifier and an optional formal parameter list, terminated by a semicolon, specifications for parameter types and modes, and the procedure body enclosed between begin and end.[8] For example, a simple procedure to compute the sum of two integers might be declared as procedure sum(a, b); integer a, b; sum := a + b; end;, where the specifications follow the parameter list to indicate types such as integer, real, boolean, text, or procedure.[14] This structure allows procedures to encapsulate reusable code blocks, functioning similarly to subprograms in earlier languages while integrating with Simula's block-oriented design.
Parameter transmission in Simula procedures supports multiple modes, with call-by-value as the default for value-type parameters like scalars (integers, reals, booleans), where a local copy of the actual parameter's value is created upon invocation, ensuring the original argument remains unchanged.[8] For non-value types such as arrays, switches, or labels, the default shifts to call-by-reference, passing a reference to the original data structure, which allows modifications to affect the caller's variables.[14] Call-by-name is an optional mode, explicitly specified for parameters that require textual substitution and re-evaluation each time the formal parameter is referenced within the procedure body; this mode, inherited from ALGOL 60, is particularly useful for passing expressions or procedure parameters but is restricted to non-value types to avoid implementation complexities.[8]
Expressions in Simula are evaluated according to rules derived from ALGOL 60, with arithmetic expressions using standard infix notation and operators such as + (addition), - (subtraction), * (multiplication), / (real division), // (integer division), and ** (exponentiation), processed from left to right subject to operator precedence where exponentiation has the highest priority, followed by multiplication and division, then addition and subtraction.[14] Procedure calls and certain constructs like conditional expressions employ prefix notation, where the operator or procedure name precedes its arguments, as in if boolean-expression then statement1 else statement2.[8] Boolean expressions combine relational operators (=, /=, <, <=, >, >=) and logical operators (and, or, not), evaluated similarly with short-circuiting not supported, ensuring all subexpressions are computed unless syntactically avoided.
Variables declared within a procedure have local scope, visible only inside that procedure's body and any nested blocks, promoting encapsulation and preventing unintended interactions.[14] Access to outer (global) variables is achieved through lexical scoping, where non-local identifiers retain their meaning from enclosing blocks unless shadowed by local declarations, enabling procedures to interact with program-wide state while maintaining modularity.[8] This scoping mechanism aligns with Simula's block structure, treating procedures as special cases of blocks for visibility rules.
Programming examples
Minimal executable program
The minimal executable program in Simula demonstrates the language's fundamental block structure, consisting of a simple declaration, assignment, and termination without any input/output operations or advanced features. This program compiles and runs successfully but produces no visible output, serving as a basic test of the compiler and runtime environment.[8] Here is the simplest valid example:Begin
Integer x;
x := 1;
End
Begin
Integer x;
x := 1;
End
Begin keyword initiates a block, which is the core organizational unit in Simula for enclosing declarations and statements.[8] The declaration [Integer](/page/Integer) x; introduces a simple integer variable named x, adhering to Simula's type-specific declaration syntax where the type precedes the identifier.[8] The assignment x := 1; uses the := operator to bind the value 1 to the variable x, performing a basic value assignment without side effects.[8] Finally, the End keyword terminates the block, completing the program's execution.[8]
The purpose of this minimal program is to illustrate Simula's essential syntax for variable handling and block scoping, derived from its ALGOL 60 heritage, while avoiding any simulation or object-oriented constructs.[8] It highlights the language's procedural foundation, where programs are structured as nested blocks that can be prefixed with classes like Direct or Simulation for more complex applications, though such prefixes are optional for this basic case.[8]
A variation to verify compilation and execution involves adding a basic output statement, such as OutInteger(x);, which would display the value 1 if the program is prefixed with the BasicIO class, but this extends beyond the pure minimal structure.[8]
Hello world demonstration
A canonical demonstration of basic output in Simula is the "Hello, World!" program, which utilizes the language's standard input/output facilities to display a simple text message on the console.[15] The following code exemplifies this:Begin
OutText("Hello, World!");
OutImage;
End
Begin
OutText("Hello, World!");
OutImage;
End
Begin and End statements.[15] The OutText procedure, part of Simula's standard I/O library, accepts a string literal (enclosed in double quotes) as its argument and transfers the contents to the output buffer by sequentially retrieving and writing each character using low-level operations like getchar.[15] If the buffer position would overflow due to the text length, OutText automatically invokes OutImage to flush the current line before continuing.[15] The explicit call to OutImage then flushes the accumulated output from the internal image buffer (a text frame) to the standard output stream (Sysout), ensuring the message is displayed, followed by a newline.[16][15]
Simula's text handling relies on the built-in text type, which represents dynamic sequences of characters managed through frames with attributes like length, pos (position), and methods such as setpos, getchar, and more for traversal.[15] Procedures like OutText and its counterpart InText (for input) were integral to Simula since its development in the 1960s, enabling formatted reporting of simulation results and data interchange in early computing environments.[17][15]
For extended output, Simula provides procedures like OutInt to format and display integer values alongside text; for instance, OutInt(42, 5); OutImage; would output the number 42 right-justified in a field of width 5.[17] This allows simple mixed-type demonstrations while adhering to the language's buffered, file-oriented I/O model.[16]
Class definition and inheritance
In Simula, classes are defined using theclass keyword followed by an optional prefix for inheritance, formal parameters, attribute declarations, and a body containing procedures and statements. This structure encapsulates data and behavior into reusable units, forming the basis for object creation. The language employs a block-structured syntax inherited from ALGOL 60, where the class body is delimited by begin and end.[8]
A representative example is a Point class representing a two-dimensional point with coordinates:
class Point (x, y); real x, y;
begin
virtual: procedure Move (dx, dy); real dx, dy;
begin
x := x + dx;
y := y + dy;
end;
end;
class Point (x, y); real x, y;
begin
virtual: procedure Move (dx, dy); real dx, dy;
begin
x := x + dx;
y := y + dy;
end;
end;
x and y are attributes passed as formal parameters during instantiation, and Move is declared as a virtual procedure, enabling it to be overridden in subclasses for dynamic dispatch at runtime. Virtual procedures support polymorphism by resolving calls based on the actual object type rather than the reference type.[8][8]
Inheritance in Simula is achieved through prefixing, where a subclass declares the parent class before its own identifier, inheriting all attributes and procedures while allowing extensions or overrides. Simula implements a single inheritance model, permitting only one parent class per subclass to maintain a linear hierarchy. For instance, a Circle subclass can extend Point by adding a radius attribute and overriding the Move procedure to adjust the center:
Point class Circle (x, y, radius); real x, y, radius;
begin
procedure Move (dx, dy); real dx, dy;
begin
! (inherited from Point);
OutText ("Circle moved to ("); OutReal (x, 3, 5); OutText (", ");
OutReal (y, 3, 5); OutText (") with radius "); OutReal (radius, 3, 5); OutImage;
end;
end;
Point class Circle (x, y, radius); real x, y, radius;
begin
procedure Move (dx, dy); real dx, dy;
begin
! (inherited from Point);
OutText ("Circle moved to ("); OutReal (x, 3, 5); OutText (", ");
OutReal (y, 3, 5); OutText (") with radius "); OutReal (radius, 3, 5); OutImage;
end;
end;
! notation invokes the parent's implementation before or after subclass-specific code, ensuring behavioral extension.[8][8]
Objects are instantiated using the new operator, which allocates memory and initializes attributes with provided actual parameters, returning a reference to the object. References are declared with the ref type qualifier. An example program demonstrating instantiation and method calls:
begin
ref (Point) p; ref (Circle) c;
p := new Point (1.0, 2.0);
c := new Circle (3.0, 4.0, 5.0);
inspect p do Move (1.0, 1.0);
inspect c do Move (2.0, 2.0);
end;
begin
ref (Point) p; ref (Circle) c;
p := new Point (1.0, 2.0);
c := new Circle (3.0, 4.0, 5.0);
inspect p do Move (1.0, 1.0);
inspect c do Move (2.0, 2.0);
end;
inspect statement provides scoped access to the object's attributes and methods, allowing calls like Move to invoke the appropriate virtual procedure dynamically— the base version for p and the overridden version for c. This mechanism exemplifies Simula's pioneering support for late binding in object-oriented programming.[8][8]
Discrete event simulation
Simula's discrete event simulation framework is centered on theSimulation class, which manages an ordered event list of processes scheduled by their activation time (EvTime), ensuring chronological execution of events. Core Simula provides basic simulation via the Simulation and Process classes, while extensions like DEMOS add advanced resource management and entity modeling.[8] Processes, defined as subclasses of the Process class, represent active entities like customers or servers, and can be suspended and rescheduled using statements such as Hold, Activate, and Passivate.[8] The Hold mechanism advances the global simulation clock by a specified duration, suspending the current process and reinserting it into the event list at the future time, which models time progression in systems like queues.[18]
Random distributions are integrated for realistic modeling of stochastic elements, such as arrival and service times. The NegExp function generates values from a negative exponential distribution, suitable for Poisson processes in queueing models, where the mean inter-arrival time determines the rate parameter.[18] Other distributions like Normal or Uniform can be used similarly with Hold to vary service durations.[18]
A representative queueing model in Simula simulates a simple single-server system, such as a barber shop, where customers arrive, are served, and depart. This can be implemented using the DEMOS extension for resource management and event scheduling, treating the server as a resource with capacity 1.[18] The following code snippet, adapted from standard single-server queue examples in Simula literature, defines the core components (assuming DEMOS is loaded as an external class):
external class Demos = 'demos'; ! Path to DEMOS library
Demos begin
ref(res) server;
server :- new res('server', 1);
entity class Customer;
begin
server.[acquire](/page/Acquire)(1);
Hold(15.0); ! Fixed service time of 15 units
server.[release](/page/Kylie_Live_in_New_York)(1);
end***Customer***;
! Schedule customers and run [simulation](/page/Simulation)
new Customer('c1').schedule(0.0);
Hold(65.0); ! Run for 65 time units
end;
external class Demos = 'demos'; ! Path to DEMOS library
Demos begin
ref(res) server;
server :- new res('server', 1);
entity class Customer;
begin
server.[acquire](/page/Acquire)(1);
Hold(15.0); ! Fixed service time of 15 units
server.[release](/page/Kylie_Live_in_New_York)(1);
end***Customer***;
! Schedule customers and run [simulation](/page/Simulation)
new Customer('c1').schedule(0.0);
Hold(65.0); ! Run for 65 time units
end;
EvTime and handling resource waits via internal queues.[18] The acquire and release operations manage the server's availability, suspending customers if occupied.
To gather output statistics, users implement counters within processes or leverage DEMOS reporting facilities. For stochastic models with exponential arrivals (mean 5 units) and service (mean 4 units) over 100 time units, the system utilization is ρ = 0.8; expected throughput is around 20 customers, with average wait time in queue approximately 16 units per the M/M/1 formula Wq = ρ / (μ (1 - ρ)).[18] These metrics provide insights into queue performance, such as the probability of idle server time or maximum queue length.[18]