| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- Coco/R - Compiler-Compiler V1.53
- Released by Pat Terry 17 September 2002
- Source file: voc_oberon.atg
- Grammar Tests:
- Deletable symbols:
- DeclarationSequence
- case
- StatementSequence
- statement
- FieldList
- FieldListSequence
- Undefined nonterminals: -- none --
- Unreachable nonterminals: -- none --
- Circular derivations: -- none --
- Underivable nonterminals: -- none --
- LL(1) conditions:
- LL(1) error in DeclarationSequence: "PROCEDURE" is the start of several alternatives.
- LL(1) error in statement: ident is the start of several alternatives.
- LL(1) error in designator: "(" is the start & successor of a deletable structure
- LL(1) error in qualident: ident is the start & successor of a deletable structure
- Listing:
- 1 COMPILER Oberon
- 2 (* A grammar for Oberon *)
- 3
- 4 CHARACTERS
- 5 eol = CHR(13) .
- 6 letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" .
- 7 digit = "0123456789" .
- 8 hexDigit = digit + "ABCDEF" .
- 9 noQuote = ANY - '"' - eol .
- 10
- 11 IGNORE CHR(9) .. CHR(13)
- 12
- 13 COMMENTS
- 14 FROM "(*" TO "*)" NESTED
- 15
- 16 TOKENS
- 17 ident = letter { letter | digit } .
- 18 integer = digit { digit } | digit { hexDigit } "H" .
- 19 real = digit { digit } "." { digit }
- 20 [ ("E" | "D") [ "+" | "-" ] digit { digit } ] .
- 21 CharConstant = digit { hexDigit } "X" .
- 22 string = '"' { noQuote } '"' .
- 23
- 24 PRODUCTIONS
- 25 Oberon = module .
- 26 number = integer | real .
- 27 identdef = ident [ "*" ] .
- 28 qualident = [ ident "." ] ident .
- 29 ConstantDeclaration = identdef "=" ConstExpression .
- 30 ConstExpression = expression .
- 31 TypeDeclaration = identdef "=" type .
- 32 type = qualident | ArrayType | RecordType | PointerType | ProcedureType .
- 33 ArrayType = "ARRAY" length { "," length } "OF" type .
- 34 length = ConstExpression .
- 35 RecordType = "RECORD" [ "(" BaseType ")" ] FieldListSequence "END" .
- 36 BaseType = qualident .
- 37 FieldListSequence = FieldList { ";" FieldList } .
- 38 FieldList = [ IdentList ":" type ] .
- 39 IdentList = identdef { "," identdef } .
- 40 PointerType = "POINTER" "TO" type .
- 41 ProcedureType = "PROCEDURE" [ FormalParameters ] .
- 42 VariableDeclaration = IdentList ":" type .
- 43 designator = qualident { "." ident | "[" ExpList "]" | "(" qualident ")" | "^" } .
- 44 ExpList = expression { "," expression } .
- 45 expression = SimpleExpression [ relation SimpleExpression ] .
- 46 relation = "=" | "#" | "<" | "<=" | ">" | ">=" | "IN" | "IS" .
- 47 SimpleExpression = [ "+" | "-" ] term { AddOperator term } .
- 48 AddOperator = "+" | "-" | "OR" .
- 49 term = factor { MulOperator factor } .
- 50 MulOperator = "*" | "/" | "DIV" | "MOD" | "&" .
- 51 factor = number | CharConstant | string | "NIL" | set
- 52 | designator [ ActualParameters ]
- 53 | "(" expression ")" | "~" factor .
- 54 set = "{" [ element { "," element } ] "}" .
- 55 element = expression [ ".." expression ] .
- 56 ActualParameters = "(" [ ExpList ] ")" .
- 57 statement = [ assignment | ProcedureCall | IfStatement |
- 58 CaseStatement | WhileStatement | RepeatStatement |
- 59 LoopStatement | WithStatement | "EXIT" |
- 60 "RETURN" [ expression ] ] .
- 61 assignment = designator ":=" expression .
- 62 ProcedureCall = designator [ ActualParameters ] .
- 63 StatementSequence = statement { ";" statement } .
- 64 IfStatement = "IF" expression "THEN" StatementSequence
- 65 { "ELSIF" expression "THEN" StatementSequence }
- 66 [ "ELSE" StatementSequence ] "END" .
- 67 CaseStatement = "CASE" expression "OF" case { "|" case }
- 68 [ "ELSE" StatementSequence ] "END" .
- 69 case = [ CaseLabelList ":" StatementSequence ] .
- 70 CaseLabelList = CaseLabels { "," CaseLabels } .
- 71 CaseLabels = ConstExpression [ ".." ConstExpression ] .
- 72 WhileStatement = "WHILE" expression "DO" StatementSequence "END" .
- 73 RepeatStatement = "REPEAT" StatementSequence "UNTIL" expression .
- 74 LoopStatement = "LOOP" StatementSequence "END" .
- 75 WithStatement = "WITH" qualident ":" qualident "DO" StatementSequence "END" .
- 76 ProcedureDeclaration = ProcedureHeading ";" ProcedureBody ident .
- 77 ProcedureHeading = "PROCEDURE" [ "*" ] identdef [ FormalParameters ] .
- 78 ProcedureBody = DeclarationSequence [ "BEGIN" StatementSequence ] "END" .
- 79 ForwardDeclaration = "PROCEDURE" "^" ident [ "*" ] [ FormalParameters ] .
- 80 DeclarationSequence = { "CONST" { ConstantDeclaration ";" }
- 81 | "TYPE" { TypeDeclaration ";" }
- 82 | "VAR" { VariableDeclaration ";" } }
- 83 { ProcedureDeclaration ";"
- 84 | ForwardDeclaration ";" } .
- 85 FormalParameters = "(" [ FPSection { ";" FPSection } ] ")" [ ":" qualident ] .
- 86 FPSection = [ "VAR" ] ident { "," ident } ":" FormalType .
- 87 FormalType = { "ARRAY" "OF" } (qualident | ProcedureType) .
- 88 ImportList = "IMPORT" import { "," import } ";" .
- 89 import = ident [ ":=" ident ] .
- 90 module = "MODULE" ident ";"
- 91 [ ImportList ] DeclarationSequence
- 92 [ "BEGIN" StatementSequence ] "END" ident "." .
- 93 END Oberon.
- 0 errors
- Statistics:
- nr of terminals: 65 (limit 400)
- nr of non-terminals: 54 (limit 210)
- nr of pragmas: 0 (limit 435)
- nr of symbolnodes: 119 (limit 500)
- nr of graphnodes: 352 (limit 1500)
- nr of conditionsets: 4 (limit 100)
- nr of charactersets: 9 (limit 250)
|