mirror of
https://github.com/Noratrieb/crapderive.git
synced 2026-01-14 16:45:08 +01:00
doc
This commit is contained in:
parent
4b2393850d
commit
7d120f7b5e
5 changed files with 49 additions and 18 deletions
|
|
@ -1,22 +1,27 @@
|
||||||
[[section-introduction-and-goals]]
|
[[section-introduction-and-goals]]
|
||||||
== Introduction and Goals
|
== Introduction and Goals
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=== Requirements Overview
|
=== Requirements Overview
|
||||||
|
|
||||||
|
==== What is Crapderive?
|
||||||
|
|
||||||
|
Crapderive is a small assembly-like programming language. It's implemented as a Rust interpreter.
|
||||||
|
|
||||||
|
|
||||||
=== Quality Goals
|
=== Quality Goals
|
||||||
|
|
||||||
|
* Ease of implementation: It must not be too complex to implement Crapderive, while still being interesting. A simpler language makes for a simpler implementation, which is easier to document.
|
||||||
|
* Interpreter UX: The interpreter must be easy to use, and should give clear error messages.
|
||||||
|
* Performance: While performance isn't a strict requirement, the interpreter should be decently fast.
|
||||||
|
|
||||||
|
|
||||||
=== Stakeholders
|
=== Stakeholders
|
||||||
|
|
||||||
|
|
||||||
|
[options="header",cols="1,2"]
|
||||||
[options="header",cols="1,2,2"]
|
|
||||||
|===
|
|===
|
||||||
|Role/Name|Contact|Expectations
|
|Role/Name|Expectations
|
||||||
| _<Role-1>_ | _<Contact-1>_ | _<Expectation-1>_
|
| Teacher | An interesting programming language with good documentation.
|
||||||
| _<Role-2>_ | _<Contact-2>_ | _<Expectation-2>_
|
| Other students | An interesting programming language they can try out and have fun with.
|
||||||
|
| Author | Get a good mark with it.
|
||||||
|===
|
|===
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,21 @@
|
||||||
[[section-architecture-constraints]]
|
[[section-architecture-constraints]]
|
||||||
== Architecture Constraints
|
== Architecture Constraints
|
||||||
|
|
||||||
|
[options="header",cols="1,2"]
|
||||||
|
|===
|
||||||
|
|Constraint|Reason
|
||||||
|
|Interpreter|Because the time for implementation is limited, the simpler option of an interpreter has to be chosen over a compiler.
|
||||||
|
|4 weeks limited time|The time of the assignment
|
||||||
|
|===
|
||||||
|
|
||||||
|
== Conventions
|
||||||
|
|
||||||
|
[options="header",cols="1,2"]
|
||||||
|
|===
|
||||||
|
|Type|Convention
|
||||||
|
|Naming|Standard Rust naming according to the official API Guidelines: https://rust-lang.github.io/api-guidelines/naming.html
|
||||||
|
|Formatting|Default `rustfmt` configuration with `imports_granularity = "Crate"` and `group_imports = "StdExternalCrate"`.
|
||||||
|
|Linting|The default `clippy` rules.
|
||||||
|
|General|https://rust-lang.github.io/api-guidelines/about.html
|
||||||
|
|Build System/Package Manager|`cargo`
|
||||||
|
|===
|
||||||
|
|
@ -3,16 +3,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=== Business Context
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**<Diagram or Table>**
|
|
||||||
|
|
||||||
**<optionally: Explanation of external domain interfaces>**
|
|
||||||
|
|
||||||
=== Technical Context
|
=== Technical Context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
[[section-solution-strategy]]
|
[[section-solution-strategy]]
|
||||||
== Solution Strategy
|
== Solution Strategy
|
||||||
|
|
||||||
|
[options="header",cols="1,2"]
|
||||||
|
|===
|
||||||
|
|Quality Goal|Approaches
|
||||||
|
|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 library `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.
|
||||||
|
|===
|
||||||
|
|
||||||
|
[plantuml]
|
||||||
|
----
|
||||||
|
[Compiler] --> [Interpreter] : Resolve labels
|
||||||
|
|
||||||
|
[Ariadne] --> [Output] : Diagnostics
|
||||||
|
----
|
||||||
|
|
@ -3,7 +3,15 @@
|
||||||
|
|
||||||
== Building Block View
|
== Building Block View
|
||||||
|
|
||||||
|
[plantuml]
|
||||||
|
----
|
||||||
|
() IO -> [Lexer]
|
||||||
|
[Lexer] -> [Parser]
|
||||||
|
[Parser] -> [Compiler]
|
||||||
|
[Compiler] --> [Interpreter]
|
||||||
|
[Interpreter] -> () IO
|
||||||
|
() IO --> [Interpreter]
|
||||||
|
----
|
||||||
|
|
||||||
=== Whitebox Overall System
|
=== Whitebox Overall System
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue