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