Next: , Previous: Raw Material, Up: Virtual Machine Specification


2.2 Concrete Syntax

The previous section has developed a basic vocabulary for statements such as “the virtual machine code for the identity function is (nil,(nil,nil))”, which are elaborated extensively in the subsequent sections on code and data formats. However, a description in this style would be inadequate without an explanation of how such an entity as (nil,(nil,nil)) is communicated to avram in a virtual machine code file. The purpose of this section is to fill the gap by explaining exactly how any given tree would be transformed to its concrete representation.

The syntax is based on a conversion of the trees to bit strings, followed by grouping the bits into blocks of six, which are then encoded by printable characters. Although anyone is free to modify avram, it is recommended that the concrete syntax described here be maintained for the sake of portability of virtual machine code applications.

Building a tree by reading the data from a file requires a more difficult algorithm than the one presented in this section, and is not considered because it's not strictly necessary for a compiler. Procedures for both reading and writing are available to C and C++ users as part of the avram library, and are also easily invoked on the virtual code level.