
Build Your Own Programming Language
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 often also includes 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.
Declare procedure:
procedure X (
params ) [locals]* [initial] [exprs]* end
Declare method:
method X ( params ) [locals]* [initial] [exprs]* end
A procedure or method has a name, parameters, and a body ending with the word end
. The body...