diff --git a/HOME_EXAM.md b/HOME_EXAM.md index 007c4d5a2c72896166cad3bc35fc5d7d0cd458ce..40c25909774b086169330df4aee144c3237cfec1 100644 --- a/HOME_EXAM.md +++ b/HOME_EXAM.md @@ -635,11 +635,12 @@ The borrowchecker should make sure that: This ensures that a variable can not be changed at the same time that another reference tries to read it. ## Conclusion -It has been very interesting to learn how a programming language is build. From the lexical analysing where sentences are parsed into tokens to the syntax analysing where the order of the tokens are ckecked. I found it very interesting and instructive to be able to build the AST and parser with the use of lalrpop. It was tricky to understand what should be done in the beginning when both learing lalrpop and rust at the same time. This fell inte place with time and after rewriting the AST compleatly it made alot more sense. +It has been very interesting to learn how a programming language is built. From the lexical analysing where sentences are parsed into tokens to the syntax analysing where the order of the tokens are ckecked. I found it very interesting and instructive to be able to build the AST and parser with the use of lalrpop. It was tricky to understand what should be done in the beginning when both learing lalrpop and rust at the same time. This fell inte place with time and after rewriting the AST compleatly it made alot more sense. When building the parser we got to use both regular expressions and context-free grammar where every production rule contains of a nonterminal symbol that is equalent to either a nonterminal and/or a terminal. In this way can a language be built recursively. For example can a nonterminal <Expr> be equal to x <Operand> y which is an abstraction of all operands that can be interpreted as a expression. The parser and lexer generator Lalrpop has helped alot with simplifying this process. -- Identifier handling and symbol table organization. Type-checking, logical inference systems. [SOS is a logical inference system] +The process of implementing the type checker and the interpreter was similar. These gave me more insight in what order a program is executed and how the compiler makes sure that the types are correct in all the different cases. To be able to execute and type check earlier decleared variables and functions was environments used where the variable/function are stored in a vecdeque containing hashmaps of strings and matching type/value. For each scope is a new hashmap pushed to the front of the vecdeque. It was good to get to do the type checker and interpreter both in code and as a logical inference system to get a deeper understanding. + - 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]