Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 10442 was 10412, checked in by gkronber, 11 years ago

#2026 also support C++-style comments

File size: 2.1 KB
RevLine 
[9842]1/* HeuristicLab
2 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
3 *
4 * This file is part of HeuristicLab.
5 *
6 * HeuristicLab is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * HeuristicLab is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
18 */
19
[9724]20$namespace=SyntaxAnalyzer
21
[9430]22COMPILER GPDefSyntaxAnalyzer
23
[9724]24CHARACTERS
[9430]25  letter = 'A'..'Z' + 'a'..'z'.
26  digit = '0'..'9'.
[9696]27
[9430]28TOKENS
[9724]29  ident = letter {letter | digit} .
[9696]30
[10412]31COMMENTS FROM "/*" TO "*/" NESTED
32COMMENTS FROM "//" TO "\r"
[9696]33
[9724]34IGNORE '\t' + '\r' + '\n'
[9696]35
[9842]36// grammar production rules in EBNF syntax
[9724]37PRODUCTIONS
[9430]38  GPDefSyntaxAnalyzer =
[9724]39    "PROBLEM" ident
40    ["CODE" "<<" {ANY} ">>" ]
41    ["INIT" "<<" {ANY} ">>" ]
42    "NONTERMINALS" { NonterminalDecl }
43    "TERMINALS" { TerminalDecl }
44    "RULES" { RuleDef }
45    ("MAXIMIZE" | "MINIMIZE") "<<" {ANY} ">>"
46    "END" ident '.'.
[9696]47
48
[9724]49  SemDecl = "LOCAL" "<<" {ANY} ">>"
[9430]50  .
[9696]51
[9724]52  SemAction = "SEM" "<<" {ANY} ">>"
[9430]53  .
[9696]54
[9727]55  NonterminalDecl = ident [ "<<" {ANY} ">>" ] '.'
[9430]56  .
[9696]57
[9727]58  TerminalDecl = ident [ "<<" {ANY} ">>" ]
[9724]59    [ "CONSTRAINTS" ConstraintDef ]
[9696]60    '.'
[9430]61  .
[9696]62
[9430]63  ConstraintDef = { ConstraintRule }.
[9724]64  ConstraintRule = ident "IN" SetDefinition .
[9430]65  SetDefinition =
[9724]66    "SET" "<<" {ANY} ">>"
67    | "RANGE" "<<" {ANY} ">>" ".." "<<" {ANY} ">>"
[9430]68  .
[9696]69
[9727]70  RuleDef = ident [ "<<" {ANY} ">>" ] '=' [SemDecl] SynExpr '.'
[9430]71  .
[9696]72
[9724]73  SynExpr = SynTerm { '|' SynTerm }
[9430]74  .
[9696]75
[9724]76  SynTerm = SynFact { SynFact }
[9430]77  .
[9696]78
[9430]79  SynFact =
[9727]80    ident [ "<<" {ANY} ">>" ]
[9724]81    | "EPS"
[9696]82    | '(' SynExpr ')'
83    | '[' SynExpr ']'
84    | '{' SynExpr '}'
85    | SemAction
[9430]86  .
87
88END GPDefSyntaxAnalyzer.
Note: See TracBrowser for help on using the repository browser.