1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

readme: add an overview of the architecture

This commit is contained in:
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

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.