summaryrefslogtreecommitdiffstats
path: root/src/Compiler/Parser.java
diff options
context:
space:
mode:
authorAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-06 00:27:16 +0000
committerAidenRushbrooke <72034940+AidenRushbrooke@users.noreply.github.com>2021-12-06 00:27:16 +0000
commitd45507823215cb3e56ac4af181093fad999644aa (patch)
tree8c27cd33facb1e724a6d849d030155395c777c9d /src/Compiler/Parser.java
parentccd18b48a653f6a339345e7be50cb1c4bb13b7de (diff)
downloadesotericFORTRAN-d45507823215cb3e56ac4af181093fad999644aa.tar.gz
esotericFORTRAN-d45507823215cb3e56ac4af181093fad999644aa.zip
Fixed real value bug
Diffstat (limited to 'src/Compiler/Parser.java')
-rw-r--r--src/Compiler/Parser.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Compiler/Parser.java b/src/Compiler/Parser.java
index 9f5e68d..7d46063 100644
--- a/src/Compiler/Parser.java
+++ b/src/Compiler/Parser.java
@@ -69,7 +69,7 @@ public class Parser {
if(matchAndAdvance(TokenType.INT)){
returntype="int";
} else if (matchAndAdvance(TokenType.REAL)){
- returntype="real";
+ returntype="double";
}else{
throw error(getCurrentToken(), "Expected function return type");
}
@@ -90,7 +90,7 @@ public class Parser {
if(matchAndAdvance(TokenType.INT)){
types.add("int");
} else if (matchAndAdvance(TokenType.REAL)){
- types.add("float");
+ types.add("double");
} else if (matchAndAdvance(TokenType.STRING)){
types.add("char*");
}
@@ -170,7 +170,7 @@ public class Parser {
//Check for array declaration
if(matchAndAdvance(TokenType.DIMENSION)){
- return arrayDeclaration("real");
+ return arrayDeclaration("double");
}
matchOrError(TokenType.DEFINE, ":: Required for variable definition");
matchOrError(TokenType.IDENTIFIER,"Expected variable name.");
@@ -180,8 +180,8 @@ public class Parser {
if(definedVars.containsKey(varName.text)){
throw error(varName, "Cannot define multiple variables with the same name");
}else{
- definedVars.put(varName.text,"real");
- return new Statement.VariableDeclaration(varName,"real");
+ definedVars.put(varName.text,"double");
+ return new Statement.VariableDeclaration(varName,"double");
}
//Check if the variable is a string