source: branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg @ 9724

Last change on this file since 9724 was 9724, checked in by gkronber, 6 years ago

#2026 changed ATG to Coco/R syntax and use Coco/R (C#) to generate scanner and parser for GPDL

File size: 1.3 KB
Line 
1$namespace=SyntaxAnalyzer
2
3COMPILER GPDefSyntaxAnalyzer
4
5CHARACTERS
6  letter = 'A'..'Z' + 'a'..'z'.
7  digit = '0'..'9'.
8
9TOKENS
10  ident = letter {letter | digit} .
11
12COMMENTS
13  FROM "/*" TO "*/" NESTED
14
15IGNORE '\t' + '\r' + '\n'
16
17PRODUCTIONS
18  GPDefSyntaxAnalyzer =
19    "PROBLEM" ident
20    ["CODE" "<<" {ANY} ">>" ]
21    ["INIT" "<<" {ANY} ">>" ]
22    "NONTERMINALS" { NonterminalDecl }
23    "TERMINALS" { TerminalDecl }
24    "RULES" { RuleDef }
25    ("MAXIMIZE" | "MINIMIZE") "<<" {ANY} ">>"
26    "END" ident '.'.
27
28
29  SemDecl = "LOCAL" "<<" {ANY} ">>"
30  .
31
32  SemAction = "SEM" "<<" {ANY} ">>"
33  .
34
35  NonterminalDecl = ident "<<" {ANY} ">>"  '.'
36  .
37
38  TerminalDecl = ident "<<" {ANY} ">>"
39    [ "CONSTRAINTS" ConstraintDef ]
40    '.'
41  .
42
43  ConstraintDef = { ConstraintRule }.
44  ConstraintRule = ident "IN" SetDefinition .
45  SetDefinition =
46    "SET" "<<" {ANY} ">>"
47    | "RANGE" "<<" {ANY} ">>" ".." "<<" {ANY} ">>"
48  .
49
50  RuleDef = ident "<<" {ANY} ">>"  '=' [SemDecl] SynExpr '.'
51  .
52
53  SynExpr = SynTerm { '|' SynTerm }
54  .
55
56  SynTerm = SynFact { SynFact }
57  .
58
59  SynFact =
60    ident "<<" {ANY} ">>"
61    | "EPS"
62    | '(' SynExpr ')'
63    | '[' SynExpr ']'
64    | '{' SynExpr '}'
65    | SemAction
66  .
67
68END GPDefSyntaxAnalyzer.
Note: See TracBrowser for help on using the repository browser.