Skip to content
Snippets Groups Projects
Commit 65f979a7 authored by Aron Strandberg's avatar Aron Strandberg
Browse files

started with SOS, bit tricky with symbols..

parent 0bac8ed6
No related branches found
No related tags found
No related merge requests found
......@@ -142,14 +142,14 @@ White_space
Showcase
```rust
fn test_i32(b: i32) -> i32 {
fn test_i32(b: i32, c: i32) -> i32 {
let a : i32 = 10 + 2 * 3;
a = -1 - (1 - 1);
return a + b;
}
fn test_bool(b: bool) -> bool {
if b && true || false {
let a : i32 = test_i32(1);
let a : i32 = test_i32(1, 999);
while (a < 5) {
a = a + 1;
}
......@@ -185,6 +185,35 @@ For furture development
- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
Structural Operational Semantics (SOS)
Symbolx:
- σ, state
- σ', derived state
- ⇓, evaluates
- c, command
- x, variable
- e, expression
- b, boolean expression
Command sequence
$\frac{<c1,σ> ⇓ σ' <c2,σ'> ⇓ σ''}{<c1;c2,σ> ⇓ σ''}$
Arithmetic
$\frac{<e1,σ> ⇓ n1 <e2, σ> ⇓ n2}{<e1 + e2, σ> ⇓ n1 plus n2}$
If true
$\frac{<b, σ> ⇓ true <c1, σ> ⇓ σ'}{<if b then c1> ⇓ σ}$
If false
$\frac{<b, σ> ⇓ false <c1, σ> ⇓ σ'}{<if b then c1> ⇓ σ}$
## Your type checker
- Give an as complete as possible set of Type Checking Rules for your language (those rules look very much like the SOS rules, but over types not values).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment