summaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-02-22 19:16:24 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2019-02-22 19:16:24 +0100
commit9f76ed072277ec01ca591e478cf7686914b9e530 (patch)
tree8906b2887b896496974446b6877ba25aa4d788f8 /old
parent638b7de7d7fb19b756a2f2bc266222b74b4e7295 (diff)
downloadcompilertests-9f76ed072277ec01ca591e478cf7686914b9e530.tar.gz
compilertests-9f76ed072277ec01ca591e478cf7686914b9e530.tar.bz2
work on adding const declarations
introduced symbol table structure
Diffstat (limited to 'old')
-rw-r--r--old/minie.ebnf10
1 files changed, 7 insertions, 3 deletions
diff --git a/old/minie.ebnf b/old/minie.ebnf
index f44e4bc..c676780 100644
--- a/old/minie.ebnf
+++ b/old/minie.ebnf
@@ -1,10 +1,11 @@
Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" .
Letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" |
- "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z".
+ "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" .
+Special = "_" .
Character = Digit | Letter | "!" | " " | "#" | "$" | "%" | "'" | "(" | ")" | "*" | "+" | "," | "," | "-" | "." | "/" | "[" | "]" | "\" | "^" | "_" | "`" | "{" | "|" | "}" | "~" .
Number = Digit { Digit } .
String = """ { Character | """ """ } """ | "'" .
-Identifier = Letter { Letter | Digit } .
+Identifier = Letter { Letter | Digit | Special } .
QualifiedIdentifier = Identifier [ "." Identifier ] .
Factor = [ "+" | "-" ] Number | String | Designator | "(" Expression ")" | ( "not" Factor ) .
Designator = QualifiedIdentifier { Selector } .
@@ -31,10 +32,13 @@ ArrayType = "array" [ Number ] "of" Type .
Type = SimpleType | ArrayType .
VariableDeclaration = VariableName ":" Type .
VariableBlock = "var" { VariableDeclaration ";" } .
+ConstExpression = Expression .
+ConstDeclaration = Identifier "=" ConstExpression .
+ConstBlock = "const" { ConstDeclaration ";" } .
ImportBlock = "import" Identifier { "," Identifier } .
ParameterDeclaration = [ "(" [ Parameter { ";" Parameter } ] ")" ] [ ":" SimpleType ] .
Parameter = ident ":" ParameterType .
ParameterType = [ "array" "of" ] Type .
ProcedureDeclaration = "procedure" Identifier [ ParameterDeclaration ] ";" DeclarationBlock StatementBlock .
-DeclarationBlock = [ VariableBlock ] { ProcedureDeclaration ";" } .
+DeclarationBlock = [ ConstBlock ] [ VariableBlock ] { ProcedureDeclaration ";" } .
Module = "module" Identifier ";" [ ImportBlock ] DeclarationBlock StatementBlock .