Refactored code structure
This commit is contained in:
18
README.md
18
README.md
@ -83,22 +83,30 @@ Each function will then be translated to generic assembler instructions.
|
||||
All the functions that are required to run the program will be added to the final assembler.
|
||||
The final assembler resolves label addresses, optimizes the performance and generates the specific x86-64 machine code from the generic instruction set.
|
||||
|
||||
### [src/build/Function.go](src/build/Function.go)
|
||||
### [src/build/core/Function.go](src/build/core/Function.go)
|
||||
|
||||
This is the "heart" of the compiler.
|
||||
Each function runs `f.Compile()` which organizes the source code into instructions that are then compiled via `f.CompileInstruction`.
|
||||
You can think of instructions as the individual lines in your source code, but instructions can also span over multiple lines.
|
||||
Each function runs `f.Compile` which organizes the source code into an abstract syntax tree that is then compiled via `f.CompileAST`.
|
||||
You can think of AST nodes as the individual statements in your source code.
|
||||
|
||||
### [src/build/ast/Parse.go](src/build/ast/Parse.go)
|
||||
|
||||
This is what generates the AST from tokens.
|
||||
|
||||
### [src/build/expression/Parse.go](src/build/expression/Parse.go)
|
||||
|
||||
This is what generates expressions from tokens.
|
||||
|
||||
## Tests
|
||||
|
||||
```shell
|
||||
go test -coverpkg=./...
|
||||
go test ./... -v
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```shell
|
||||
go test -bench=. -benchmem
|
||||
go test ./tests -bench=. -benchmem
|
||||
```
|
||||
|
||||
## License
|
||||
|
Reference in New Issue
Block a user