From 868000c689d39c489d1d9835bd79b3786044d3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilma=20Krutr=C3=B6k?= <wilkru-7@student.ltu.se> Date: Thu, 5 Nov 2020 07:59:04 +0000 Subject: [PATCH] Update HOME_EXAM.md --- HOME_EXAM.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/HOME_EXAM.md b/HOME_EXAM.md index cd809a3..7c1c0d1 100644 --- a/HOME_EXAM.md +++ b/HOME_EXAM.md @@ -606,9 +606,9 @@ fn main() -> () { ``` ```rust -fn b(z: &mut i32, w: &mut i32) -> () { - *z = *z + 1; - *w = *w + 1; +fn b(x: &mut i32, y: &mut i32) -> () { + *x = *x + 1; + *y = *y + 1; }; fn main() -> () { let mut x: i32 = 5; @@ -634,6 +634,8 @@ 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. +The implementation of the borrow checking is not compleated. It is possible to make references and change the value via the reference. The interpreter does currently not reject illeagal borrows. + ## Conclusion 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. -- GitLab