readme: add an overview of the architecture

pull/6846/head
Alexander Medvednikov 2020-11-12 09:32:46 +01:00 committed by GitHub
parent ee86d0e483
commit 4ddfff287c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -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.