|
| 1 | +This project implements a simple bytecode virtual machine, assembler, |
| 2 | +and self-hosting compiler for a scheme-like high-level langauge. It is |
| 3 | +intended as a vehicle for playing with ideas in bytecode interpreting |
| 4 | +and compilation. It is not intended for any sort of real or |
| 5 | +production use. |
| 6 | + |
| 7 | +To build the project, simply type |
| 8 | + $ make |
| 9 | + |
| 10 | +You will need gcc installed as well as GNU guile, a scheme |
| 11 | +implementation used to bootstrap the compiler. |
| 12 | + |
| 13 | +This will build the following products: |
| 14 | + |
| 15 | + interpreter: the standard bytecode interpreter. |
| 16 | + |
| 17 | + trace_interpreter: a version of the bytecode interpreter that |
| 18 | + prints a log describing the machine state as |
| 19 | + each instruction is executed |
| 20 | + |
| 21 | + assembler: the assembler for building executable bytecode |
| 22 | + files from bytecode assembly files. |
| 23 | + |
| 24 | + schemer.bytecode: the scheme-like language compiler, built from |
| 25 | + its own image, that can be run using the |
| 26 | + interpreter. |
| 27 | + |
| 28 | +A bytecode program can be run using either the regular or tracing |
| 29 | +interpreter as: |
| 30 | + $ ./[trace-]interpreter program.bytecode |
| 31 | + |
| 32 | +To use the compiler, a source program should be directed into the |
| 33 | +interpreter's standard input, the bytecode assembly will be written to |
| 34 | +standard output: |
| 35 | + |
| 36 | + $ ./interpreter schemer.bytecode < program.sch > program.asm |
| 37 | + |
| 38 | +To assemble the compiled program into executable bytecode, send it as |
| 39 | +input to the assembler command: |
| 40 | + |
| 41 | + $ ./assembler <program.asm >program.bytecode |
| 42 | + |
| 43 | +Note: The interpreter does not provide any standard-error like output |
| 44 | +stream, so the compiler will write its error messages to standard-out |
| 45 | +which will confuse the assembler and lead to bizarre error messages. |
0 commit comments