Inspired by The Super Tiny Compiler project. I rewrite it by Golang to make it easier to understand, and I also reduce some concept!
$ git clone [email protected]:ClarkThan/the-super-super-tiny-compiler.git
$ cd the-super-super-tiny-compiler && go build compiler.go
$ ./compiler
add(3, sub(4, len("foo")));
$ ./compiler 23
23;
$ ./compiler '(add 23 (len "Jordan"))'
add(23, len("Jordan"));
$ ./compiler '(foo "Jordan") (add 23 45)'
foo("Jordan");
add(23, 45);
Feel free to modify code for inspecting the Tokenizer, Parser and CodeGen output. And I also encourage you improve the error message of the invalid input.