The Emerald Basic Compiler
--------------------------
Program name : embc
Usage : embc [input file]
Embc reads Emerald Basic files (.emb) and compiles them into standard
.emo files, which can then be loaded my a Emerald interpreter as code modules.
There are two symbols that embc reconizes. Each symbol converts the
given data to binary. The symbols are as follows.
i <instruction>
l <literal-type> <literal>
Embc also allows comments. A comment starts with a `;' and terminates
when the end of the line is reached.
- Instructions
Refer to the file `instr.txt' for a list of valid instructions.
- Literal types
int1 integer; one byte
int2 integer; two bytes
int4 integer; four bytes
float4 floating point; four bytes
float8 floating point; eight bytes
string string; size varys (one byte per character)
- EMB Example Code
;
; File: hello.emb
; Author: Christopher D. Granz
;
; Description:
; Defines one function, hello(). When called, hello() prints the
; message "Hello World!" to the standard output terminal. Calls one
; builtin function, sysout().
;
l int1 1 ; File format version.
l int2 2 ; Number of entries in the symbol table.
;
; Symbol Table
;
l int2 5
l string "hello"
l int2 6
l string "sysout"
l int4 1 ; Global code size.
;
; Global code
;
i END
l int2 1 ; Number of functions.
;
; Function: hello()
;
l int4 0 ; Function flags.
l int1 0 ; Number of arguments.
l int2 0 ; Symbol table name reference.
l int4 23 ; Code size.
i PUSH_STRING ; Function code.
l int2 14
l string "\nHello World!\n"
l int1 77 ; Byte code used to tell the linker the
; following symbol table reference is to
; be tranlated into an actaul function.
l int2 1
i CALL_BUILTIN_FUNC
i POP
i END ; Function code end.
;
; End of hello.emb
;
--