From 26bb0a8df18ba8bbbe5861f5bb8f7f576c041a00 Mon Sep 17 00:00:00 2001 From: me Date: Fri, 9 Jan 2026 09:55:09 +0200 Subject: [PATCH] add structure --- first-interpreter/readme.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/first-interpreter/readme.md b/first-interpreter/readme.md index d267de7..fdfa82c 100644 --- a/first-interpreter/readme.md +++ b/first-interpreter/readme.md @@ -4,6 +4,14 @@ Code for a very simple interpreter. Accompanying blogpost: https://alloca.space/blog/my-first-interpreter.html +## Build and run + +Requires: gcc, make + +```sh +make run +``` + ## Example Program ```go @@ -18,10 +26,12 @@ while counter { print(sum) ``` -## Build and run +## Structure -Requires: gcc, make - -```sh -make run -``` +- `main.c` - entry point. Reads user input and calls the interpreter +- `run.c` - glue code. invokes the interpreter stages. +- `ast.h` - AST definitions +- `lex.h` - Tokens definitions +- `lex.c` - Stage 1 - Lexing: Text -> Tokens +- `parsing.c` - Stage 2 - Parsing: Tokens -> Ast +- `execute.c` - Stage 3 - Execute: Ast -> Output