diff options
author | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-11-07 01:23:19 +0000 |
---|---|---|
committer | AidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com> | 2021-11-07 01:23:19 +0000 |
commit | f8b888716211b78900db62ede497fa4ac2100c00 (patch) | |
tree | 3ea66c732de6abb95b10e708d0ab33651cb6b327 /src/Compiler/Environment.java | |
parent | d3046e3b1481cf6d190b8fcb814985e29852b5eb (diff) | |
download | esotericFORTRAN-f8b888716211b78900db62ede497fa4ac2100c00.tar.gz esotericFORTRAN-f8b888716211b78900db62ede497fa4ac2100c00.zip |
Basic floating point support and small improvements to error handing
Diffstat (limited to 'src/Compiler/Environment.java')
-rw-r--r-- | src/Compiler/Environment.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Compiler/Environment.java b/src/Compiler/Environment.java index 0e682a4..3ccf425 100644 --- a/src/Compiler/Environment.java +++ b/src/Compiler/Environment.java @@ -5,11 +5,13 @@ import java.util.Map; 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); } + //Get a variable if it is defined, or report an error public Object getVariable(String name){ if(variableMap.containsKey(name)){ return variableMap.get(name); @@ -18,6 +20,7 @@ public class Environment { throw new Error(); } + //Assign a value to an existing variable public void assignVariable(String name,Object value){ if(variableMap.containsKey(name)){ variableMap.put(name, value); |