summaryrefslogtreecommitdiffstats
path: root/src/Compiler/Environment.java
diff options
context:
space:
mode:
authorAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-05 03:27:18 +0000
committerAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-05 03:27:18 +0000
commit9e6c89f1fa93287104381e02f0bbbdd6060a9382 (patch)
tree65a26fbbccb0172805b131b7100ffcabb7790da3 /src/Compiler/Environment.java
parent43909b350b9084ed33f121a15c5770224cbdc79f (diff)
downloadesotericFORTRAN-9e6c89f1fa93287104381e02f0bbbdd6060a9382.tar.gz
esotericFORTRAN-9e6c89f1fa93287104381e02f0bbbdd6060a9382.zip
Added subroutines and comments for most files
Diffstat (limited to 'src/Compiler/Environment.java')
-rw-r--r--src/Compiler/Environment.java6
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;