add structure
This commit is contained in:
parent
9b280dca92
commit
26bb0a8df1
1 changed files with 16 additions and 6 deletions
|
|
@ -4,6 +4,14 @@ Code for a very simple interpreter.
|
||||||
|
|
||||||
Accompanying blogpost: https://alloca.space/blog/my-first-interpreter.html
|
Accompanying blogpost: https://alloca.space/blog/my-first-interpreter.html
|
||||||
|
|
||||||
|
## Build and run
|
||||||
|
|
||||||
|
Requires: gcc, make
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make run
|
||||||
|
```
|
||||||
|
|
||||||
## Example Program
|
## Example Program
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
|
@ -18,10 +26,12 @@ while counter {
|
||||||
print(sum)
|
print(sum)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build and run
|
## Structure
|
||||||
|
|
||||||
Requires: gcc, make
|
- `main.c` - entry point. Reads user input and calls the interpreter
|
||||||
|
- `run.c` - glue code. invokes the interpreter stages.
|
||||||
```sh
|
- `ast.h` - AST definitions
|
||||||
make run
|
- `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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue