summaryrefslogtreecommitdiff
path: root/old
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-09-02 21:24:22 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2018-09-02 21:24:22 +0200
commit7a66db4c15f8e8661b9cb967be43cbbc67022b11 (patch)
tree2f581b75e0dc92f19faa92bff44fe021edc34b99 /old
parentc5c75d786de3e6d21ec146df9e043896feb8dfba (diff)
downloadcompilertests-7a66db4c15f8e8661b9cb967be43cbbc67022b11.tar.gz
compilertests-7a66db4c15f8e8661b9cb967be43cbbc67022b11.tar.bz2
some work on an E to C converter
Diffstat (limited to 'old')
-rw-r--r--old/minie.ebnf3
-rw-r--r--old/oberon07.enbf83
2 files changed, 86 insertions, 0 deletions
diff --git a/old/minie.ebnf b/old/minie.ebnf
index a315889..453434d 100644
--- a/old/minie.ebnf
+++ b/old/minie.ebnf
@@ -1,3 +1,6 @@
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".
+Identifier = Letter { Letter | Digit } .
+Block = "begin" "end" ";" .
+Module = "module" Identifier ";" Block .
diff --git a/old/oberon07.enbf b/old/oberon07.enbf
new file mode 100644
index 0000000..c7b4d6a
--- /dev/null
+++ b/old/oberon07.enbf
@@ -0,0 +1,83 @@
+EBNF of Oberon-07 (David Egan Evans, 20160727)
+-=-=-
+
+Following is a rearrangement of the Oberon-07 EBNF. This reflects the official
+EBNF of the Oberon Report (not the Appendix), including the Project Oberon 2013
+change to CASE as a type guard for RECORD extension.
+
+
+"character" refers to a member of type CHAR.
+
+ident = letter {letter | digit}.
+letter = "A" | "B" | ... | "Z" | "a" | "b" | ... | "z".
+digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
+number = integer | real.
+integer = digit {digit} | digit {hexDigit} "H".
+real = digit {digit} "." {digit} [ScaleFactor].
+ScaleFactor = "E" ["+" | "-"] digit {digit}.
+hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F".
+string = """ {character} """ | digit {hexDigit} "X".
+
+module = MODULE ident ";" [ImportList] DeclarationSequence
+ [BEGIN StatementSequence] END ident "." .
+ImportList = IMPORT import {"," import} ";".
+import = ident [":=" ident].
+DeclarationSequence = [CONST {ConstDeclaration ";"}]
+ [TYPE {TypeDeclaration ";"}] [VAR {VariableDeclaration ";"}]
+ {ProcedureDeclaration ";"}.
+ConstDeclaration = identdef "=" ConstExpression.
+ConstExpression = expression.
+TypeDeclaration = identdef "=" StrucType.
+StrucType = ArrayType | RecordType | PointerType | ProcedureType.
+ArrayType = ARRAY length {"," length} OF type.
+length = ConstExpression.
+RecordType = RECORD ["(" BaseType ")"] [FieldListSequence] END.
+BaseType = qualident.
+FieldListSequence = FieldList {";" FieldList}.
+FieldList = IdentList ":" type.
+IdentList = identdef {"," identdef}.
+PointerType = POINTER TO type.
+ProcedureType = PROCEDURE [FormalParameters].
+FormalParameters = "(" [FPSection {";" FPSection}] ")" [":" qualident].
+FPSection = [VAR] ident {"," ident} ":" FormalType.
+FormalType = {ARRAY OF} qualident.
+qualident = [ident "."] ident.
+identdef = ident ["*"].
+VariableDeclaration = IdentList ":" type.
+type = qualident | StrucType.
+ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident.
+ProcedureHeading = PROCEDURE identdef [FormalParameters].
+ProcedureBody = DeclarationSequence [BEGIN StatementSequence]
+ [RETURN expression] END.
+expression = SimpleExpression [relation SimpleExpression].
+relation = "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.
+SimpleExpression = ["+" | "-"] term {AddOperator term}.
+AddOperator = "+" | "-" | OR.
+term = factor {MulOperator factor}.
+MulOperator = "*" | "/" | DIV | MOD | "&".
+factor = number | string | NIL | TRUE | FALSE |
+ set | designator [ActualParameters] | "(" expression ")" | "~" factor.
+designator = qualident {selector}.
+selector = "." ident | "[" ExpList "]" | "^" | "(" qualident ")".
+set = "{" [element {"," element}] "}".
+element = expression [".." expression].
+ExpList = expression {"," expression}.
+ActualParameters = "(" [ExpList] ")" .
+statement = [assignment | ProcedureCall | IfStatement | CaseStatement |
+ WhileStatement | RepeatStatement | ForStatement].
+assignment = designator ":=" expression.
+ProcedureCall = designator [ActualParameters].
+StatementSequence = statement {";" statement}.
+IfStatement = IF expression THEN StatementSequence
+ {ELSIF expression THEN StatementSequence}
+ [ELSE StatementSequence] END.
+CaseStatement = CASE expression OF case {"|" case} END.
+case = [CaseLabelList ":" StatementSequence].
+CaseLabelList = LabelRange {"," LabelRange}.
+LabelRange = label [".." label].
+label = integer | string | qualident.
+WhileStatement = WHILE expression DO StatementSequence
+ {ELSIF expression DO StatementSequence} END.
+RepeatStatement = REPEAT StatementSequence UNTIL expression.
+ForStatement = FOR ident ":=" expression TO expression [BY ConstExpression]
+ DO StatementSequence END.