-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
103 lines (70 loc) · 3.31 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
============
= Overview =
============
The Noneleatic Languages are a series of languages, of which only the first
two exist so far, which swerve away from the programming languages and
philosophy of programming of mainstream computer science. The history of
computing and computer science is completely suffused with an anxiety about
the possibility of code changing state. Almost every mainstream innovation in
computing languages can be seen in this light (although there are other things
going on as well), from the invention of the conditional branch statement in
the formation of the edvac---a way to keep possibilities in the variables,
rather than the code---to the formation of structured programming, and later
object oriented programming. The noneleatic languages, instead, insist that as
state changes, code ought to change too. Rather than a double realm of
code xor state, the noneleatic languages imagine code and state together.
This repository contains C code for two programs: nevm and neasm, a virtual
machine and an assembler. nevm is a virtual machine with no branching control,
but with strict enough encoding that it is (relatively!) easy to rewrite the
program. neasm is an assembler which produces code for nevm. See the
documentation in doc/ and the example programs in examples/.
===========================
= Building and Installing =
===========================
To build:
cp config.def.mk config.mk
make
Edit config.mk to match your system, if necessary.
Installation is not necessary to run the programs. However, if you want to
install, type:
sudo make install
To compile the example programs, run:
make examples
See the Makefile for other potential make targets.
===========
= Running =
===========
neasm [-o outfile] file
Assemble "file" for running with nevm. If file is omitted or "-", reads from
stdin.
Options:
-o outfile Write assembler output to outfile instead of stdout.
./nevm [-d delay] [-g] [-l location] file [[-l location] file] ...
Load file(s) into memory at the specified locations, then start the virtual
machine. When the virtual machine terminates, it will wait for a keypress
before exiting. To exit the virtual machine at any time, press CTRL-C.
Options:
-g Enter debug mode. Debug mode displays the memory layout of the
virtual machine and delays the execution of each operation by
2 seconds.
-d delay Delay the execution of each operation by the specified number
of seconds. Overrides the delay for -g.
-l location Load the file at the given location in memory. If unspecified,
all files will be loaded contiguously in memory, beginning
at location 0.
========================
= Running the Examples =
========================
Here are the suggested ways to run the examples.
The branch example can be a little tricky to follow, so I recommend running it
a few times with 10 second delay until you see what's going on.
./nevm -g -d 10 branch
The hello world has a lot of looping, so run it with a short delay to stay
sane.
./nevm -g -d 0.1 helloworld
tenprint will loop endlessly. No reason not to run it as quickly as possible.
./nevm -g -d 0 tenprint
fibonacci calculates the fibonacci numbers using simple recursion, and so
takes O(fib n) time to calculate the nth number. Skip the debug output to have
another number or two appear before you're waiting forever.
./nevm fibonacci