aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-01-24 22:54:14 +0100
committertomsmeding <tom.smeding@gmail.com>2018-01-24 22:54:14 +0100
commitc4fe34aecd563b0a27c62bdebd9ec1fcb2941806 (patch)
treeae5c70a96fcf055a47b06e77acaadc875228b7f7
parent7d4da488404d65805132a8787951759897a60dfc (diff)
Hints in README
-rw-r--r--README.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/README.md b/README.md
index ca029f6..292cefb 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,18 @@
-This is a C compiler for the MAR ([Much-Assembly-Required](https://muchassemblyrequired.com/)) virtual machine, written in C. It is pretty unsophisticated at the moment, but should be able to compile VERY rudimentary C programs, like those in `test/`. Please patch in HWI calls yourself at the moment...
+This is a C compiler for the MAR ([Much-Assembly-Required](https://muchassemblyrequired.com/)) virtual machine, written in C. It is pretty unsophisticated at the moment, but should be able to compile VERY rudimentary C programs, like those in `test/`.
Note that even though this claims to be a "C compiler" written in C, it is *VERY* far from being able to compile itself.
The compiler depends on `flex` and `bison`, and of course a working C compiler (tested with `clang` and `gcc`; the makefile uses `gcc`). Install those, then run `make` to build, and `./ccomp` to run.
+
+Hints:
+
+- Don't define any names starting with `__`. Stuff will blow up.
+- Asm literals are possible, and the instructions are actually parsed by the compiler. This is to enable inlining variable references and possible optimisations later. Note that because of this, the syntax might be more restricted than you'd like (e.g. `1 + 2` is not allowed). Literals look as follows:
+
+```
+asm {
+ mov a, 3
+ mov b, 42
+ hwi 9
+}
+```