LME My own Compiler Devlog #5
Finished the first real end-to-end version of Luna today.
Wrote generation.h - takes the parse tree from the parser and walks it to spit out x86-64 NASM assembly. Right now it just handles the one node type I have (NodeExit) and generates the mov/syscall pair for exiting with a given code.
Rewired main.cpp so it actually uses the tokenizer -> parser -> generator pipeline properly instead of skipping straight from tokens to asm like before. Cleaner flow now:
source -> tokens -> parse tree -> asm -> nasm -> ld -> binary
Tested it with:
cik 42;
Compiled clean, ran the output binary, echo $? gave 42. First time the whole pipeline worked end to end without me hand-patching anything.
Also wrote a proper README and a .gitignore so I can actually put this on GitHub without dumping build folders and .idea junk into the repo.
Still only supports one statement (cik ;), no variables or math yet. Next up: probably adding a second statement type so the parser/generator actually have to branch on something.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.