diff --git a/HOME_EXAM.md b/HOME_EXAM.md
index 7634c1e1cf762ce354e4dae5a01c68dae9d1efa6..8da001636a6d27a9f4d5930a6ac824175d4dffe4 100644
--- a/HOME_EXAM.md
+++ b/HOME_EXAM.md
@@ -1,71 +1,782 @@
 # Home Exam D7050E
-
-- Fork this repo and put your answers (or links to answers) in THIS file.
-
 ## Your repo
 
-- Link to your repo here:
+- Link to your repo here: https://github.com/Cryslacks/D7050E-Compiler
 
 ## Your syntax
 
-- Give an as complete as possible EBNF grammar for your language.
+> - Give an as complete as possible EBNF grammar for your language.
+
+### Program
+```ebnf
+    : Func Program
+    | Func
+    ;
+```
+### Func
+```ebnf
+    : "fn" Id Params "->" Type Block
+    | "fn" Id Params Block
+    ;
+```
+### Params
+```ebnf
+    : "()"
+    | "(" [ "," ], Param ")"
+    ;
+```
+### Param
+```ebnf
+    : "mut" Id ":" Type
+    | Id ":" Type
+    ;
+```
+### Block
+```ebnf
+    : "{" StmtSeq* Stmt "}"
+    | "{" StmtSeq* "}"
+    ;
+```
+### StmtSeq
+```ebnf
+    : ";"
+    | Stmt ";"
+    | StmtBlock
+    ;
+```
+### Stmt
+```ebnf
+    : "let" Id ":" Type "=" Expr
+    | "let" Id ":" Type
+    | "let" Id "=" Expr
+    | "let" Id
+    | "let" "mut" Id ":" Type "=" Expr
+    | "let" "mut" Id ":" Type
+    | "let" "mut" Id "=" Expr
+    | "let" "mut" Id
+    | Expr "=" Expr
+    | Expr1
+    ;
+```
+### StmtBlock
+```ebnf
+    : "while" Expr Block
+    | "if" Expr Block "else" Block
+    | "if" Expr Block
+    | Block
+    ;
+```
+### Expr
+```ebnf
+    : ExprBlock
+    | Expr1
+    ;
+```
+### ExprBlock
+```ebnf
+    : "if" Expr Block "else" Block
+    | Block
+    ;
+```
+### Expr1
+```ebnf
+    : Expr1 LoCode Expr2
+    | Expr1 ArCode Expr2
+    | Expr2
+    ;
+```
+### Expr2
+```ebnf
+    : Expr2 FactorCode Lit
+    | Lit
+    ;
+```
+### Lit
+```ebnf
+    : Id Exprs
+    | ArCode Lit
+    | "!" Lit
+    | Bool
+    | Num
+    | Id
+    | "&" Lit
+    | "&mut" Lit
+    | "*" Lit
+    | "(" Expr ")"
+    ;
+```
+### Exprs
+```ebnf
+    : "()"
+    | "(" [ "," ], Expr1 ")"
+```
+### LoCode
+```ebnf
+    : "&&"
+    | "||"
+    | "=="
+    | "!="
+    | ">"
+    | "<"
+    | ">="
+    | "<="
+    ;
+```
+### ArCode
+```ebnf
+    : "+"
+    | "-"
+    ;
+```
+### FactorCode
+```ebnf
+    : "*"
+    | "/"
+    ;
+```
+### Type
+```ebnf
+    : "i32"
+    | "bool"
+    | "()"
+    | "&" Type
+    | "&mut" Type
+    ;
+```
+### Num
+```ebnf
+    : "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" 
+    ;
+```
+
+### Id
+```ebnf
+    : (LetterLow | LetterHigh | "_")+ (LetterLow | LetterHigh | Num | "_")*
+    ;
+```
+### Bool
+```ebnf
+    : "true"
+    | "false"
+    ;
+```
+### LetterHigh
+```ebnf
+    : "A" | "B" | "C" | "D" | "E" | "F" | "G"
+    | "H" | "I" | "J" | "K" | "L" | "M" | "N"
+    | "O" | "P" | "Q" | "R" | "S" | "T" | "U"
+    | "V" | "W" | "X" | "Y" | "Z"
+    ;
+```
+### LetterLow
+```ebnf
+    : "a" | "b" | "c" | "d" | "e" | "f" | "g"
+    | "h" | "i" | "j" | "k" | "l" | "m" | "n"
+    | "o" | "p" | "q" | "r" | "s" | "t" | "u" 
+    | "v" | "w" | "x" | "y" | "z" 
+    ;
+```
+
+### Accepted code
+```rust
+fn main() {
+    let mut a = 3;
+    let b = &mut a;
+    *b = 1;
+
+    while a <= 3 {
+        *b = add(*b, 1);
+    }
+
+    let c = a / 3;
+}
+
+fn add(a:i32, b:i32) -> i32 {
+    a+b
+}
+```
+
+> - Give an example that showcases all rules of your EBNF. The program should "do" something as used in the next exercise.
+> - For your implementation, show that your compiler successfully accepts the input program.
+
+**Accepted code**
+```rust
+fn main() {
+    let mut a = 3;
+    let b = &mut a;
+
+    while *b <= 3 {
+        *b = add(*b, 1);
+    }
+
+    let d = *b / 3;
+}
+
+fn add(a:i32, b:i32) -> i32 {
+    a+b
+}
+```
+
+> - Give a set of examples that are syntactically illegal, and rejected by your compiler.
+
+**Rejected Code**
+#### Fn misstype
+```rust
+f main(){
+    ...
+}
+```
+
+#### Let misstype
+```rust
+lt a = 3;
+```
+
+#### Type wrongly positioned
+```rust
+let bool a = true;
+```
+
+#### Else if is not implemented
+```rust
+if a==b {
+    ...
+} else if a > b {
+    ...
+} else if a < b {
+    ...
+}
+```
+
+#### This is not python
+```python
+def main():
+    greet = "hello"
+    print(greet)
+    return 0xDEADC0DE
+```
+
+
+> - Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+
+Our syntax supports the most basic subset of Rust including:
+- Functions with return primitive return types (i32, boolean)
+- let, if, if-else, while, assign, return
+- Function calls, references, dereferences
+- Implemented precedence by dividing operands into logical, conditional and arithmetic operands
+- ArCode can have precendence over FactorCode by parantesized precendence
+
+Future extensions that can be made
+- Advanced error handling such as location information
+- Implement more types (String, double, ...)
+- Global variables
+- Pretty printing
+- Nestled functions
+- Else if 
+- For loop
 
-- Give an example that showcases all rules of your EBNF. The program should "do" something as used in the next exercise.
+## Your semantics
 
-- For your implementation, show that your compiler successfully accepts the input program.
+> - Give a (simplified) Structural Operational Semantics (SOS) for your language. You don't need to detail rules that are similar (follow the same pattern). Regarding variable environment (store) you may omit details as long as the presentation is easy to follow.
+> - Explain (in text) what an interpretation of your example should produce, do that by dry running your given example step by step. Relate back to the SOS rules. You may skip repetitions to avoid cluttering.
+
+The Structural Operational Semantics (SOS) that my compiler follows is as described:
+
+Symbols used: 
+- σ, state
+- σ', derived state
+- ⇓, evaluates
+- c, command
+- v, variable
+- e, expression
+
+Expression can result in a
+- b, boolean 
+- i, integer 
+- f, function 
+
+
+### Function sequence
+```math
+<f, σ>⇓σ'
+```
+
+```Rust
+fn a(){
+    b();
+}
+```
+### Command sequence
+
+```math
+\frac{<c_1,σ> ⇓ σ' <c_2,σ'> ⇓ σ''}{<c_1;c_2,σ> ⇓ σ''}
+```
+
+```rust
+let a = 1;
+let b = 2;
+```
+
+### Operands for integer expressions 
+
+```math
+\frac{<e_1,σ> ⇓ i_1 <e_2,σ> ⇓ i_2}{<e_1 + e_2,σ> ⇓ i_1 \text{add } i_2}
+```
+
+Above is addition operand of two expressions described, here are all the integer expressions that can be described in the same way:
+- "+", Addition
+- "-", Subtraction
+- "*", Multiplication
+- "/", Divison
+- ">", Greater than
+- "<", Lesser than
+- "=>", Greater than or equal to
+- "=<", Lesser than or equal to
+- "==", Equal
+- "!=", Not equal
+
+```rust
+(1+2)*3;
+3 < 4;
+3 == 3;
+```
+### Operands for boolean expressions
+```math
+\frac{<e_1,σ> ⇓ b_1 <e_2,σ> ⇓ b_2}{<e_1 == e_2,σ> ⇓ b_1 \text{equal } b_2}
+```
+Above is an equal operation of two expressions described, here are all the boolean expressions that can be described in the same way:
+- "||", Or
+- "&&", And
+- "==", Equal
+- "!=", Not equal
+
+
+```rust
+true || false;
+true != false;
+```
+
+### Different references of expression
+```math
+\frac{<e,σ> ⇓ v}{<\&e, σ> ⇓ \text{ref }  v}
+```
+
+```rust
+&a;
+```
+
+Referencing an expression creates a reference to the variable that expression is evaulated to.
+
+```math
+\frac{<e,σ> ⇓ v}{<\&\text{mut } e, σ> ⇓ \text{refmut } v}
+```
+
+```rust
+&mut a;
+```
+
+Creates a mutable reference to the variable which the expression is evaluated to.
+
+```math
+\frac{<e,σ> ⇓ v}{<*e, σ> ⇓ \text{deref }  v}
+```
+
+```rust
+*a;
+```
+Dereferencing works the same way as reference but the other way around.
+
+
+### Function call expression
+```math
+<e,σ> ⇓ \text{return of }e
+```
+
+```rust
+fn a() -> i32 {
+    1+1
+} 
+
+fn main(){
+    let a = a();
+}
+```
+
+A function call evaluates to the return evaluation of the function call e.
+
+### Let expression
+
+```math
+\frac{<v, σ> ⇓ <\text{let } v \text{ = } e,σ> ⇓ σ'}{<\text{let } v \text{ = } e, σ> ⇓ σ[v \text{ = } e]}
+```
+
+```rust
+let a = 1;
+```
+
+The let expression declares a unique variable $`v`$ with a type $`t`$ to the current scope.
+
+```math
+\frac{<v, σ> ⇓ <\text{let mut } v \text{ = } e,σ> ⇓ σ'}{<\text{let mut } v \text{ = } e, σ> ⇓ σ[v \text{ = } E]}
+```
+
+```rust
+let mut a = 1;
+```
+The let expression can also declare a unique mutable variable $`v`$ with a type $`t`$ to the current scope.
+
+### Assignment expression
+
+```math
+\frac{}{<v \text{ = } e, σ> ⇓ σ[v \text{ = } e]}
+```
 
-- Give a set of examples that are syntactically illegal, and rejected by your compiler.
+```rust
+a = 1;
+```
 
-- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+The assignment expression assigns a new value to a mutable variable.
+### If expression
 
-## Your semantics
+```math
+\frac{<e,σ> ⇓ b <c_1,σ> ⇓ σ' <c_2,σ> ⇓ σ''}{<\text{if } e \text{ then } c_1 \text{ else } c_2, σ> ⇓ σ'\text{ || }σ''}
+```
+
+```rust
+if a > b {
+    a();
+}else{
+    b();
+}
+```
+
+The if expression will result in the state to change to $`σ'`$ or $`σ''`$ depending on the value of the boolean $`b`$.
+### While expression
+
+```math
+\frac{<e,σ> ⇓ \text{ false}}{<\text{while } e \text{ do } c, σ> ⇓ σ}
+```
+
+A while expression that is false will lead to no change of state since the expression will just be skipped over.
+
+```math
+\frac{<e,σ> ⇓ \text{ true} <c,σ> ⇓ σ' <\text{while } e \text{ do } c,σ'> ⇓ σ''}{<\text{while } e \text{ do } c, σ'> ⇓ σ''}
+```
 
-- Give a (simplified) Structural Operational Semantics (SOS) for your language. You don't need to detail rules that are similar (follow the same pattern). Regarding variable environment (store) you may omit details as long as the presentation is easy to follow.
+```rust
+let a = 0;
+while a < 5 {
+    a = a + 1;
+}
+```
 
-- Explain (in text) what an interpretation of your example should produce, do that by dry running your given example step by step. Relate back to the SOS rules. You may skip repetitions to avoid cluttering.
+A while expression that is true will lead to two changes of state since the command changes the state and the while also changes the state.
+### Return expression
 
-- For your implementation, give a program (or set of test programs) that cover all the semantics of your language that you have successfully implemented. (Maybe a subset of the input language accepted by the grammar.)
+```math
+\frac{<f,σ> ⇓ σ}{<\text{return } e, σ> ⇓ σ[\text{return }e]}
+```
 
-- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+```rust
+fn a() -> i32 {
+    1+1
+} 
+```
+
+A function returns by adding the return value into the current state when terminating.
+
+> - For your implementation, give a program (or set of test programs) that cover all the semantics of your language that you have successfully implemented. (Maybe a subset of the input language accepted by the grammar.)
+
+```rust
+fn main() {
+    let mut a = 3;
+    let b = &mut a;
+
+    while *b <= 3 {
+        *b = add(*b, 1);
+    }
+
+    let d = *b / 3;
+}
+
+fn add(a:i32, b:i32) -> i32 {
+    a+b
+}
+```
 
 ## Your type checker
 
-- Give a simplified set of Type Checking Rules for your language (those rules look very much like the SOS rules, but over types not values). Also here you don't need to detail rules that are similar (follow the same pattern).
+> - Give a simplified set of Type Checking Rules for your language (those rules look very much like the SOS rules, but over types not values). Also here you don't need to detail rules that are similar (follow the same pattern).
+> - Demonstrate each "type rule" by an example. You may use one or several "programs" to showcase where rules successfully apply.
 
-- Demonstrate each "type rule" by an example. You may use one or several "programs" to showcase where rules successfully apply.
+We use the same symbols as the interpreter but with one addition
+- t, type
 
-- For your implementation, give a set of programs demonstrating that ill-typed programs are rejected, connect back to the Type Checking Rules to argue why these are illegal and thus should be rejected.
+Different types are
+- i32, integer
+- bool, boolean
+- (), Unit
+- &t, reference to type
+- mut t, mutable version of type
+- *t, dereference to type
+- Unknown
 
-- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+### Command sequence
 
-## Your borrrow checker
+```math
+\frac{<c_1,σ> ⇓ σ' <c_2,σ'> ⇓ σ''}{<c_1;c_2,σ> ⇓ σ''}
+```
 
-- Give a specification for well versus ill formed borrows. (What are the rules the borrow checker should check).
+Exactly as the SOS rules of the interpreter.
 
-- Demonstrate the cases of ill formed borrows that your borrow checker is able to detect and reject.
+### Operands for integer types
+
+```math
+\frac{<e_1,σ> ⇓ \text{i32} <e_2,σ> ⇓ \text{i32}}{<e_1 + e_2,σ> ⇓ \text{i32}}
+```
+
+Above is addition operand of two expressions described, here are all the integer expressions that can be described in the same way:
+- "+", Addition
+- "-", Subtraction
+- "*", Multiplication
+- "/", Divison
+- ">", Greater than
+- "<", Lesser than
+- "=>", Greater than or equal to
+- "=<", Lesser than or equal to
+- "==", Equal
+- "!=", Not equal
+
+```rust
+(1+2)*3;
+3*false; // Error type missmatch
+```
+
+### Operands for boolean types
+
+```math
+\frac{<e_1,σ> ⇓ \text{Bool} <e_2,σ> ⇓ \text{Bool}}{<e_1 == e_2,σ> ⇓ \text{Bool}}
+```
+
+Above is an equal operation of two expressions described, here are all the boolean expressions that can be described in the same way:
+- "||", Or
+- "&&", And
+- "==", Equal
+- "!=", Not equal
+
+```rust
+true || false;
+true != 13; // Error type missmatch
+```
+
+### Different references
+
+```math
+\frac{<e,σ> ⇓ \text{\&} t}{<*e,σ> ⇓ t}
+```
+
+```rust
+let a = 3;
+let b = &a;
+let c = *b; 
+let d: bool = *b; // Error type missmatch
+```
 
-- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+We do not check references interaction in the type checker we only care about the type its referencing to.
 
-## Your LLVM/Crane-Lift backend (optional)
 
-- Let your backend produce LLVM-IR/Crane Lift IR for an example program (covering the translations implemented).
+### Function call type
+```math
+<e,σ> ⇓ \text{return type of } e
+```
+
+```rust
+fn a() -> i32 {
+    1+1
+} 
+
+fn main(){
+    let a = a();
+    let b: bool = a(); // Error type missmatch
+}
+```
+
+A function call checks the return type of the specified function.
+
+
+### Let types
+
+```math
+\frac{<v,σ> ⇓ t <\text{let } v \text{ : } t,σ> ⇓ σ'}{<\text{let } v \text{ : } t, σ> ⇓ σ[v \text{ = } t]}
+```
+
+```rust
+let a: i32 = 1;
+```
+
+The let expression declares a unique variable $`v`$ with a type $`t`$ to the current scope.
+
+```math
+\frac{<v,σ> ⇓ t <\text{let mut } v \text{ : } t,σ> ⇓ σ'}{<\text{let } v \text{ : } t, σ> ⇓ σ[v \text{ = } mut t]}
+```
+
+```rust
+let mut a: bool = true;
+```
+The let expression can also declare a unique mutable variable $`v`$ with a type $`t`$ to the current scope.
+
+### Assignment expression
+
+```math
+\frac{<v,σ> ⇓ \text{mut }t <e,σ> ⇓ t}{<v \text{ = } t,σ> ⇓ σ[v \text{ = } t]}
+```
+
+```rust
+let mut a: i32;
+a = 1;
+a = true; // Error type missmatch
+let b: i32;
+b = 1; // Error assignment to non mutable
+```
+
+The assignment expression assigns a new value to a mutable variable if the types match.
+
+### If
+```math
+\frac{<e,σ> ⇓ \text{ Bool} <c_1,σ> ⇓ σ' <c_2,σ> ⇓ σ''}{<\text{if }e\text{ then }c_1\text{ else }c_2,σ> ⇓ σ}
+```
+
+```rust
+if false {
+    a(); // This will still be checked since we do not evaluate the expression
+}else{
+    b(); // This will also be checked since we do not pick a certain path to look at
+}
+```
+
+The difference between interpreter and type checker is that we do not check which path the if else statement is going to take. We only care about that $`e`$ is of boolean type and that no type errors happends in both the if and else.
+
+### While
+```math
+\frac{<e,σ> ⇓ \text{ Bool} <c,σ> ⇓ σ' <\text{while }e\text{ do }c, σ'> ⇓ σ''}{<\text{while }e\text{ do }c,σ> ⇓ σ''}
+```
+
+```rust
+while false {
+    a(); // This will still be checked since we do not evaluate the expression
+}
+```
+Same goes here, the difference between interpreter and type checker is that we do not check if the while statement will run. We only care about that $`e`$ is of boolean type and that no type errors happends in the while path.
+
+### Return
+```math
+\frac{<f,σ> ⇓ σ}{<\text{return: }t,σ> ⇓ σ[\text{return: }t]}
+```
+
+Checks if a function returns with the pre-declared type. Otherwise an error for type missmatch is raised.
+
+
+> - For your implementation, give a set of programs demonstrating that ill-typed programs are rejected, connect back to the Type Checking Rules to argue why these are illegal and thus should be rejected.
+
+#### Return type is wrong
+```rust
+fn a() -> i32 {
+    true // Error type missmatch
+}
+```
+
+#### Assignment type is wrong
+```rust
+fn main() {
+    let a: i32 = true; // Error type missmatch
+}
+```
+
+#### Assignment type is not mutable
+```rust
+fn main() {
+    let a: i32;
+    a = 1; // Error assignment to non mutable
+}
+```
+
+#### Assignment type is wrong
+```rust
+fn main() {
+    while 1+2 { // Error while expression type not boolean
+        a();
+    } 
+
+    if 1+2 { // Error if expression type not boolean
+        a();
+    }
+}
+```
+
+> - Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+
+The type checker will return a custom error message depending on which error occured. It will display minimal location information such as in which function the error occured in. If the error is in the checking of a statement the type checker will also return which line caused the error. 
+
+## Your borrrow checker
+
+- Give a specification for well versus ill formed borrows. (What are the rules the borrow checker should check).
+- Demonstrate the cases of ill formed borrows that your borrow checker is able to detect and reject.
 
-- Describe the translation process, and connect back to the generated IR.
 
-- Compare your solution to the requirements (as stated in the README.md). What are your contributions to the implementation.
+### Any borrow may only last for the lifetime of the owners scope.
+```rust
+ let borrowed;
+ if true {
+     let if_scope = 1;
+     borrowed = &if_scope;
+ }
+ let another_scope = *borrowed; // <-- Error the owners scope is gone
+```
+
+### One mutably borrow at a time.
+```rust
+ let mut a = 1;
+ let bm_a = &mut a;
+ let bm_a_2 = &mut a; // <-- Error second mutable borrow
+ *bm_a = 2;
+ *bm_a_2 = 3; // <-- Error actually occurs here but is caused by the above one
+```
+
+### One or more immutably borrows at a time.
+```rust
+ let mut a = 1;
+ let b_a = &a;
+ let b_a_2 = &a;
+ let b_a_3 = &a;
+```
+
+### You cannot borrow a mutably and immutably at the same time.
+```rust
+ let mut a = 1;
+ let b_a = &a;
+ let bm_a = &mut a; // <-- Error cannot borrow mutable since a is already borrowed as immutable 
+ let temp = *b_a;  
+```
+The reason Rust has a feature in the compiler called the borrow checker is to prevent data-races. A data-race is when two or more pointers are pointing to the same memory location and which one or more is also writing to the location. This causes a data-race due to writing and reading is not synchronized.
 
 ## Overall course goals and learning outcomes.
 
 Comment on the alignment of the concrete course goals (taken from the course description) to the theory presented, work You have done and knowledge You have gained. (I have put some comments in [...]).
 
 - Lexical analysis, syntax analysis, and translation into abstract syntax.
+- - We had to use the lalrpop frame work for creating a lexer. This made it faster to create an AST from no knowledge and kickstarting into creating and understanding how a compiler works. The hardships in working with lalrpop was first create an AST which would not lead to ambiguity (which lalrpop has a passion of hatred against). 
 
 - Regular expressions and grammars, context-free languages and grammars, lexer and parser generators. [lalr-pop is a classical parser generator, it auto generated the lexer for you based on regular expressions but allows for you to define the lexer yourself for more control]
+- - Lalrpop made tokenizing terminals and recognizing it and finally running the code easier, since it generates the lexer from plain regular expressions. 
 
 - Identifier handling and symbol table organization. Type-checking, logical inference systems. [SOS is a logical inference system]
+- - The description that SOS give in regards to the compiler makes the compiler easier to understand in a sense. Even though I expect some of my SOS definitions to be poorly/wrongly written it still gave me a deeper insight into how the compiler actually works in a more formal way.
+- - Creating the typechecker made me understand more of how checks works. Things I did not know was that all branches of a if-ifelse-else statement is checked even though the code might never run into one of them. 
 
 - Intermediate representations and transformations for different languages. [If you attended, Recall lectures relating LLVM/Crane-lift, discussions on SSA (Single Static Assignment) used in LLVM/Crane-lift, and discussions/examples on high [level optimization](https://gitlab.henriktjader.com/pln/d7050e_2020/-/tree/generics_and_traits/examples)]
+- - I did not have time to go into any depth into anything regarding llvm.
 
 - Code optimization and register allocation. Machine code generation for common architectures. [Both LLVM/Crane-Lift does the "dirty work" of backend optimization/register allocation leveraging the SSA form of the LLVM-IR]
+- - I did not have time to go into any depth into anything regarding llvm.
 
-Comment on additional things that you have experienced and learned throughout the course.
+Comment on additional things that you have experienced and learned throughout the course.
\ No newline at end of file