From 91b545562d67664d3383e2b72aef2075c9770e37 Mon Sep 17 00:00:00 2001 From: Rodrigo Raya <rodrigo.raya@epfl.ch> Date: Wed, 22 Sep 2021 12:41:30 +0000 Subject: [PATCH] Update labs_01.md --- labs/labs_01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/labs_01.md b/labs/labs_01.md index 201528d..36fa335 100644 --- a/labs/labs_01.md +++ b/labs/labs_01.md @@ -65,7 +65,7 @@ A few final notes: * To find constructors and functions in the program, you have to search in the ''SymbolTable'' passed along with the program. To do this, use the three helper methods provided in the interpreter: * ''isConstrutor'' will return whether the ''Identifier'' argument is a type constructor in the program * ''findFunctionOwner'' will return the module which contains the given ''Identifier'', which has to be a function in the program. E.g. if you give it the ''printInt'' function of the ''Std'' module, you will get the string ''"Std"''. - * ''findFunction'' will return the function definition given a pair of Strings representing the module containing the function, and the function name. The return value is of type ''FunDef'' (see [the AST definitions](https://gitlab.epfl.ch/lara/cs320/-/blob/main/labs/labs01_material/SymbolicTreeModule.scala). + * ''findFunction'' will return the function definition given a pair of Strings representing the module containing the function, and the function name. The return value is of type ''FunDef'' (see [the AST definitions](https://gitlab.epfl.ch/lara/cs320/-/blob/main/labs/labs01_material/SymbolicTreeModule.scala)). * When comparing Strings by reference, compare the two ''StringValue''s directly and not the underlying Strings. The reason is that the JVM may return true when comparing Strings by equality when it is not expected (it has to do with JVM constant pools). * Some functions contained in the ''Std'' module are built-in in the language, i.e. they are hard-coded in the interpreter because they cannot be implemented in Amy otherwise. An example of a built-in function is ''printString''. When you implement the interpreter for function calls, you should first check if the function is built-in, and if so, use the implementation provided in the ''builtIns'' map in the interpreter. * When a program fails (e.g. due to a call to ''error'' or a match fail), you should call the dedicated method in the Context: ''ctx.reporter.fatal''. -- GitLab