mirror of
https://github.com/Noratrieb/crapderive.git
synced 2026-01-14 16:45:08 +01:00
d
This commit is contained in:
parent
be1305bbb8
commit
e3b554bd41
2 changed files with 14 additions and 16 deletions
|
|
@ -5,21 +5,6 @@
|
||||||
|
|
||||||
== Building Block View
|
== Building Block View
|
||||||
|
|
||||||
[plantuml]
|
|
||||||
----
|
|
||||||
() IO <- [Main] : read input file
|
|
||||||
[Main] <-> [Parser] : lex and parse code
|
|
||||||
[Main] <--> [IR] : compile
|
|
||||||
[Main] <--> [Interpreter] : interpret code
|
|
||||||
[Interpreter] <--> () IO : stdin and stdout
|
|
||||||
----
|
|
||||||
|
|
||||||
The interpreter follows a classic interpreter architecture. First, the source is tokenized by a lexer, implemented using the `logos` library (https://crates.io/crates/logos).
|
|
||||||
|
|
||||||
Then, a handwritten recursive descent parser parses the token stream. The abstract syntax tree is then given to a small compiler, that compiles it down to a smaller and more limited IR. It also resolves jump labels to offsets.
|
|
||||||
|
|
||||||
The interpreter then executes this lower level IR.
|
|
||||||
|
|
||||||
==== Parser `parser.rs`
|
==== Parser `parser.rs`
|
||||||
|
|
||||||
Lexes the source code, and then parses those tokens into an abstract syntax tree.
|
Lexes the source code, and then parses those tokens into an abstract syntax tree.
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,24 @@
|
||||||
== Runtime View
|
== Runtime View
|
||||||
|
|
||||||
|
|
||||||
|
[plantuml]
|
||||||
|
----
|
||||||
|
() IO <- [Main] : read input file
|
||||||
|
[Main] <-> [Parser] : lex and parse code
|
||||||
|
[Main] <--> [IR] : compile
|
||||||
|
[Main] <--> [Interpreter] : interpret code
|
||||||
|
[Interpreter] <--> () IO : stdin and stdout
|
||||||
|
----
|
||||||
|
|
||||||
|
The interpreter follows a classic interpreter architecture. First, the source is tokenized by a lexer, implemented using the `logos` library (https://crates.io/crates/logos).
|
||||||
|
|
||||||
|
Then, a handwritten recursive descent parser parses the token stream. The abstract syntax tree is then given to a small compiler, that compiles it down to a smaller and more limited IR. It also resolves jump labels to offsets.
|
||||||
|
|
||||||
|
The interpreter then executes this lower level IR.
|
||||||
|
|
||||||
|
|
||||||
=== <Runtime Scenario 1>
|
=== <Runtime Scenario 1>
|
||||||
|
|
||||||
|
|
||||||
* _<insert runtime diagram or textual description of the scenario>_
|
* _<insert runtime diagram or textual description of the scenario>_
|
||||||
* _<insert description of the notable aspects of the interactions between the
|
* _<insert description of the notable aspects of the interactions between the
|
||||||
building block instances depicted in this diagram.>_
|
building block instances depicted in this diagram.>_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue