diff options
Diffstat (limited to 'src/Compiler/Environment.java')
-rw-r--r-- | src/Compiler/Environment.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Compiler/Environment.java b/src/Compiler/Environment.java index 1bb0e88..8ae8724 100644 --- a/src/Compiler/Environment.java +++ b/src/Compiler/Environment.java @@ -2,11 +2,13 @@ package Compiler; import java.util.HashMap; import java.util.Map; +/** + * Class to record defined variables during the translation stage + */ public class Environment { private final Map<String,Object> variableMap = new HashMap<>(); //Define a variable inside the current environment - //Maybe check if variable is already defined? public void defineVariable(String name,Object value){ variableMap.put(name, value); } @@ -20,7 +22,7 @@ public class Environment { throw new Error(); } - //Get a variable if it is defined, or report an error + //Check if a variable is defined, or report an error public Boolean checkVariable(Token token){ if(variableMap.containsKey(token.text)){ return true; |