readme: add an overview of the architecture
parent
ee86d0e483
commit
4ddfff287c
|
@ -19,10 +19,14 @@ working compiler executable.
|
|||
But don't worry, you can always simply run `make` (or `make.bat`), it will
|
||||
download the C version of the compiler and rebuild it from scratch.
|
||||
|
||||
The architecture of the compiler is very simple and has three distinct steps:
|
||||
|
||||
Parse/generate AST (`v.parser`) => Check types (`v.checker`) => Generate C/JavaScript/machine code (`v.gen`)
|
||||
|
||||
|
||||
The main files are:
|
||||
|
||||
1. `cmd/v/v.v`. The entry point.
|
||||
1. `cmd/v/v.v` The entry point.
|
||||
|
||||
- V figures out the build mode.
|
||||
- Constructs the compiler object (`struct V`).
|
||||
|
@ -44,7 +48,7 @@ unresolved. They are resolved later in the type checker.
|
|||
contains all types, consts, and functions, as well as several helpers to search
|
||||
for objects by name, register new objects, modify types' fields, etc.
|
||||
|
||||
6. `v/checker`. Type checker and resolver. It processes the AST and makes sure
|
||||
6. `v/checker` Type checker and resolver. It processes the AST and makes sure
|
||||
the types are correct. Unresolved types are resolved, type information is added
|
||||
to the AST.
|
||||
|
||||
|
|
Loading…
Reference in New Issue