parsodusparser.pds added

This commit is contained in:
kwullaer 2017-01-27 14:20:31 +01:00 committed by Robin Jadoul
parent 818386de56
commit d2b106e6e5
1 changed files with 66 additions and 0 deletions

66
src/parsodusParser.pds Normal file
View File

@ -0,0 +1,66 @@
parser: SLR(1)
lexesis: parsodusLexer.lxs
terminals:
"PARSER"
"PRECEDENCE"
"LEXESIS"
"TERMINALS"
"START"
"GRAMMAR"
"PARSERTYPE"
"LEFT"
"RIGHT"
"NONASSOC"
"LEXESISNAME"
"TERMINAL"
"VARIABLE"
"ARROW"
"SEMICOLON"
"COLON"
"PIPE"
"RULENAME"
start:
<sections>
grammar:
<sections> ::= <section> <sections>;
<section> ::= "PARSER" "COLON" "PARSERTYPE"
| "LEXESIS" "COLON" "LEXESISNAME"
| "TERMINALS" "COLON" <terminals>
| "PRECEDENCE" "COLON" <precedences>
| "START" "COLON" "TERMINAL"
| "GRAMMAR" "COLON" <rules>
;
<terminals> ::= "TERMINAL" <terminals>
|
;
<precedences> ::= <precedence> <terminals> <precedences>
| <precedence> <terminals>
;
<precedence> ::= "LEFT"
| "RIGHT"
| "NONASSOC"
;
<rules> ::= <rule> <rules>
| <rule>
;
<rule> ::= "VARIABLE" "ARROW" <bodies> "SEMICOLON";
<bodies> ::= <body> "PIPE" <bodies>
| <body>
;
<body> ::= <term_var> "RULENAME"
| <term_var>
;
<term_var> ::= <term_var> "VARIABLE"
| <term_var> "TERMINAL"
|
;