/* HeuristicLab * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ $namespace=SyntaxAnalyzer COMPILER GPDefSyntaxAnalyzer CHARACTERS letter = 'A'..'Z' + 'a'..'z'. digit = '0'..'9'. TOKENS ident = letter {letter | digit} . COMMENTS FROM "/*" TO "*/" NESTED COMMENTS FROM "//" TO "\r" IGNORE '\t' + '\r' + '\n' // grammar production rules in EBNF syntax PRODUCTIONS GPDefSyntaxAnalyzer = "PROBLEM" ident ["CODE" "<<" {ANY} ">>" ] ["INIT" "<<" {ANY} ">>" ] "NONTERMINALS" { NonterminalDecl } "TERMINALS" { TerminalDecl } "RULES" { RuleDef } ("MAXIMIZE" | "MINIMIZE") "<<" {ANY} ">>" "END" ident '.'. SemDecl = "LOCAL" "<<" {ANY} ">>" . SemAction = "SEM" "<<" {ANY} ">>" . NonterminalDecl = ident [ "<<" {ANY} ">>" ] '.' . TerminalDecl = ident [ "<<" {ANY} ">>" ] [ "CONSTRAINTS" ConstraintDef ] '.' . ConstraintDef = { ConstraintRule }. ConstraintRule = ident "IN" SetDefinition . SetDefinition = "SET" "<<" {ANY} ">>" | "RANGE" "<<" {ANY} ">>" ".." "<<" {ANY} ">>" . RuleDef = ident [ "<<" {ANY} ">>" ] '=' [SemDecl] SynExpr '.' . SynExpr = SynTerm { '|' SynTerm } . SynTerm = SynFact { SynFact } . SynFact = ident [ "<<" {ANY} ">>" ] | "EPS" | '(' SynExpr ')' | '[' SynExpr ']' | '{' SynExpr '}' | SemAction . END GPDefSyntaxAnalyzer.