-
Book Overview & Buying
-
Table Of Contents
Build Your Own Programming Language - Second Edition
By :
You can’t write a Unicon program without declaring things. Declaring something is the act of associating a name, visible within some scope and lifetime, with some chunk of code or memory capable of holding a value. Next, let’s learn how different program components can be declared.
Unicon programs consist of one or more procedures beginning with main(). Program structure may also include classes. Unicon distinguishes user-defined procedures from functions that are built into the language. The following patterns show the syntax structure for the primary declarations of bodies of code in Unicon’s procedures and methods:
procedure X ( params ) [locals]* [initial] [exprs]* end
method X ( params ) [locals]* [initial] [exprs]* end
All procedures and methods have a name, zero or more parameters, and a body ending with the word end...