o
c
This commit is contained in:
nora 2022-07-04 12:44:40 +02:00
parent 8d03964f76
commit f7e862a8fd
6 changed files with 50 additions and 100 deletions

88
Cargo.lock generated
View file

@ -26,16 +26,6 @@ dependencies = [
"yansi", "yansi",
] ]
[[package]]
name = "asm-thing"
version = "0.1.0"
dependencies = [
"ariadne",
"dbg-pls",
"insta",
"logos",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -94,6 +84,16 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "crapderive"
version = "0.1.0"
dependencies = [
"ariadne",
"dbg-pls",
"insta",
"logos",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.3.2" version = "1.3.2"
@ -105,9 +105,9 @@ dependencies = [
[[package]] [[package]]
name = "dbg-pls" name = "dbg-pls"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f28b65c59b1830ac65640335cf2ebef868e8c9982d1cbab01ce843ebe74d37a" checksum = "50e8bb7470a10e67fb07347d044987e38a7d28ede5a2febfea112626145d885d"
dependencies = [ dependencies = [
"dbg-pls-derive", "dbg-pls-derive",
"itoa", "itoa",
@ -123,9 +123,9 @@ dependencies = [
[[package]] [[package]]
name = "dbg-pls-derive" name = "dbg-pls-derive"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18ad0d32e09e083b0bf764cc9c2f1956518afb16b6ae0e1110c909d056f8271f" checksum = "cec2fcd181de78b524aec9f40127b2a49d8d0aa8347594fb4d6e17f02b9fc9ff"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -156,15 +156,15 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.11.2" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.8.2" version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
@ -172,9 +172,9 @@ dependencies = [
[[package]] [[package]]
name = "insta" name = "insta"
version = "1.14.1" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc3e639bcba360d9237acabd22014c16f3df772db463b7446cd81b070714767" checksum = "4126dd76ebfe2561486a1bd6738a33d2029ffb068a99ac446b7f8c77b2e58dbc"
dependencies = [ dependencies = [
"console", "console",
"once_cell", "once_cell",
@ -219,9 +219,9 @@ dependencies = [
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.4" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]] [[package]]
name = "logos" name = "logos"
@ -278,9 +278,9 @@ checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
[[package]] [[package]]
name = "onig" name = "onig"
version = "6.3.1" version = "6.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" checksum = "1eb3502504c9c8b06634b38bfdda86a9a8cef6277f3dec4d8b17c115110dd2a3"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"lazy_static", "lazy_static",
@ -290,9 +290,9 @@ dependencies = [
[[package]] [[package]]
name = "onig_sys" name = "onig_sys"
version = "69.7.1" version = "69.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" checksum = "8bf3fbc9b931b6c9af85d219c7943c274a6ad26cff7488a2210215edd5f49bf8"
dependencies = [ dependencies = [
"cc", "cc",
"pkg-config", "pkg-config",
@ -320,9 +320,9 @@ dependencies = [
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.1.11" version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f28f53e8b192565862cf99343194579a022eb9c7dd3a8d03134734803c7b3125" checksum = "9e1516508b396cefe095485fdce673007422f5e48e82934b7b423dc26aa5e6a4"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn", "syn",
@ -330,18 +330,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.39" version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.18" version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -386,18 +386,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.137" version = "1.0.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.137" version = "1.0.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -406,9 +406,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.81" version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -441,9 +441,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.96" version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -495,9 +495,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.9" version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217"
dependencies = [ dependencies = [
"itoa", "itoa",
"libc", "libc",
@ -506,9 +506,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
[[package]] [[package]]
name = "unicode-linebreak" name = "unicode-linebreak"

View file

@ -1,5 +1,5 @@
[package] [package]
name = "asm-thing" name = "crapderive"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"

View file

@ -25,9 +25,6 @@ endif::backend-html5[]
// configure EN settings for asciidoc // configure EN settings for asciidoc
include::src/config.adoc[] include::src/config.adoc[]
include::src/about-arc42.adoc[]
// horizontal line // horizontal line
*** ***
@ -86,3 +83,6 @@ include::src/11_technical_risks.adoc[]
include::src/12_glossary.adoc[] include::src/12_glossary.adoc[]
***
include::src/about-arc42.adoc[]

View file

@ -6,7 +6,7 @@
|Quality Goal|Approaches |Quality Goal|Approaches
|Ease of implementation| Simple language with not too many features. Many features out of scope, like static data. |Ease of implementation| Simple language with not too many features. Many features out of scope, like static data.
|Interpreter UX|Keeping track of source locations throughout the compilation/interpretation process, usage of the crate `ariadne` (https://crates.io/crates/ariadne) for displaying diagnostics. |Interpreter UX|Keeping track of source locations throughout the compilation/interpretation process, usage of the crate `ariadne` (https://crates.io/crates/ariadne) for displaying diagnostics.
|Performance|Written in the native compiled language. Internally, the AST is compiled into a lower level IR, where jump labels are resolved to instruction offsets. |Performance|Written in a native compiled language (Rust). Internally, the AST is compiled into a lower level IR, where jump labels are resolved to instruction offsets, and span information is kept separately to improve cache locality.
|=== |===
[plantuml] [plantuml]
@ -14,4 +14,4 @@
[Compiler] --> [Interpreter] : Resolve labels [Compiler] --> [Interpreter] : Resolve labels
[Ariadne] --> [Output] : Diagnostics [Ariadne] --> [Output] : Diagnostics
---- ----

View file

@ -28,51 +28,3 @@ The compiler compiles the AST into the IR, resolving labels.
==== Interpreter `interpret.rs` ==== Interpreter `interpret.rs`
The interpreter interprets the IR and interacts with the outside world through standard input and output. The interpreter interprets the IR and interacts with the outside world through standard input and output.
=== Level 2
==== White Box _<building block 1>_
_<white box template>_
==== White Box _<building block 2>_
_<white box template>_
...
==== White Box _<building block m>_
_<white box template>_
=== Level 3
==== White Box <_building block x.1_>
_<white box template>_
==== White Box <_building block x.2_>
_<white box template>_
==== White Box <_building block y.1_>
_<white box template>_

View file

@ -228,9 +228,7 @@ impl InterpretCtx {
} }
} }
// tag::interpret[]
pub fn interpret(stmts: Vec<Stmt>) -> Result<()> { pub fn interpret(stmts: Vec<Stmt>) -> Result<()> {
// end::interpret[]
let mut ctx = InterpretCtx { let mut ctx = InterpretCtx {
memory: vec![0; MEMORY_SIZE], memory: vec![0; MEMORY_SIZE],
registers: [0; 16], registers: [0; 16],