add .vrepl_temp.v to .gitignore and fix some grammar

pull/2161/head
Don Alfons Nisnoni 2019-09-29 18:58:37 +08:00 committed by Alexander Medvednikov
parent ee8ff39454
commit a1f0e940b7
2 changed files with 3 additions and 1 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@
# Thumbnails # Thumbnails
._* ._*
.vrepl_temp.v

View File

@ -7,6 +7,7 @@ The compiler itself is located in `compiler/`
The main files are: The main files are:
1. `main.v` The entry point. 1. `main.v` The entry point.
- V figures out the build mode. - V figures out the build mode.
- Constructs the compiler object (`struct V`). - Constructs the compiler object (`struct V`).
- Creates a list of .v files that need to be parsed. - Creates a list of .v files that need to be parsed.
@ -18,7 +19,7 @@ The main files are:
In V, objects can be used before declaration, so there are 2 passes. During the first pass, it only looks at declarations and skips function bodies. It memorizes all function signatures, types, consts, etc. During the second pass it looks at function bodies and generates C (e.g. `cgen('if ($expr) {'`) or machine code (e.g. `gen.mov(EDI, 1)`). In V, objects can be used before declaration, so there are 2 passes. During the first pass, it only looks at declarations and skips function bodies. It memorizes all function signatures, types, consts, etc. During the second pass it looks at function bodies and generates C (e.g. `cgen('if ($expr) {'`) or machine code (e.g. `gen.mov(EDI, 1)`).
The formatter is embedded in the parser. Correctly formatted tokens are emitted as they are parsed. This allowed to simplify the compiler and avoid duplication, but slowed it down a bit. In the future this will be fixed with build flags and separate binaries for C generation, machine code generation, and formatting. This way there will be no unnecessary branching and function calls. The formatter is embedded in the parser. Correctly formatted tokens are emitted as they are parsed. This allowed us to simplify the compiler and avoid duplication, but slowed it down a bit. In the future, this will be fixed with build flags and separate binaries for C generation, machine code generation, and formatting. This way there will be no unnecessary branching and function calls.
3. `scanner.v` The scanner's job is to parse a list of characters and convert them to tokens. It also takes care of string interpolation, which is a mess at the moment. 3. `scanner.v` The scanner's job is to parse a list of characters and convert them to tokens. It also takes care of string interpolation, which is a mess at the moment.