Changes between Version 11 and Version 12 of Fundamentals


Ignore:
Timestamp:
05/13/23 13:09:22 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Fundamentals

    v11 v12  
     1= CIVL-C Language
    12
    2 = Overview of CIVL-C
     3== Overview of CIVL-C
    34
    4 ==  Main Concepts
     5===  Main Concepts
    56
    67CIVL-C is an extension of a subset of Standard C. It includes the most commonly-used elements of C, including most of the syntax, types, expressions, and statements. Missing are some of the more esoteric type qualifiers, bitwise operations (at least for now), and much of the standard library. Moreover, none of the C language elements dealing with concurrency are included, as CIVL-C has its own concurrency primitives.
     
    1415Scopes and processes are the two central themes of CIVL-C. Each has a static and a dynamic aspect. The static scopes correspond to the lexical scopes in the program—typically, regions de- limited by curly braces `{`. . . `}`. At runtime, these scopes are instantiated when control in a process reaches the beginning of the scope. Processes are created dynamically by spawning functions; hence the functions are the static representation of processes.
    1516
    16 == Example Illustrating Scopes and Processes
     17=== Example Illustrating Scopes and Processes
    1718
    1819To understand the static and dynamic nature of scopes and processes, and the relations between them, we consider the (artificial) example code in Fig. 1(a). The static scopes in the code are numbered from 0 to 6.
     
    4344* Processes are created when functions are spawned; they disappear from the state when their stack becomes empty (either because the process terminates normally or invokes the exit system function).
    4445
    45 == Structure of a CIVL-C program
     46=== Structure of a CIVL-C program
    4647
    4748A CIVL-C program is structured very much like a standard C program. In particular, a CIVL- C program may use the preprocessor directives specified in the C Standard, and with the same meaning. A source program is preprocessed, then parsed, resulting in a translation unit, just as with standard C. The main differences are the nesting of function definitions and the new primitives beginning with `$`, which are described in detail in the remainder of this part of the manual.
     
    5556As usual, a translation unit consists of a sequence of variable declarations, function prototypes, and function definitions in file scope. In addition, assume statements may occur in the file scope.  These are used to state assumptions on the input values to a program.
    5657
    57 = Sequential Elements
     58== Sequential Elements
    5859
    5960In this chapter we describe the main sequential elements of the language. For the most part these are the same as in C. Primitives dealing with concurrency are introduced in the next chapter.
    6061
    61 ==  Types
     62===  Types
    6263
    63 === Standard types inherited from C
     64==== Standard types inherited from C
    6465
    6566The `civlc.cvh` defines standard types inherited from C. The boolean type is denoted `_Bool`, as in C. Its values are 0 and 1, which are also denoted by `$false` and `$true`, respectively.
     
    7172Array types, `struct` and `union` types, `char`, and pointer types (including pointers to functions) are all exactly as in C.
    7273
    73 === The bundle type: `$bundle`
     74==== The bundle type: `$bundle`
    7475
    7576CIVL-C includes a type named `$bundle`, declared in the CIVL-C standard header `bundle.cvh`. A bundle is basically a sequence of data, wrapped into an atomic package. A bundle is created using a function that specifies a region of memory. One can create a bundle from an array of integers, and another bundle from an array of reals. Both bundles have the same type, `$bundle`. They can therefore be entered into an array of `$bundle`, for example. Hence bundles are useful for mixing objects of different (even statically unknown) types into a single data structure. Later, the contents of a bundle can be extracted with another function that specifies a region of memory into which to unpack the bundle; if that memory does not have the right type to receive the contents of the bundle, a runtime error is generated. The bundle type and its functions are provided by the library `bundle.cvh`.
    7677The relevant functions for creating and manipulating bundles are given in ...
    7778
    78 === The `$scope` type
     79==== The `$scope` type
    7980
    8081An object of type `$scope` is a reference to a dynamic scope. It may be thought of as a “dynamic
    8182scope ID, ” but it is not an integer and cannot be converted to an integer. Operations defined on scopes are discussed in Section ....
    8283
    83 === The `$range` and `$domain` types
     84==== The `$range` and `$domain` types
    8485
    8586CIVL-C provides certain abstract datatypes that are useful for representing iteration spaces of loops in an abstract way.