-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathBGF.rsc
More file actions
39 lines (34 loc) · 1.12 KB
/
BGF.rsc
File metadata and controls
39 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@contributor{Vadim Zaytsev - vadim@grammarware.net - SWAT, CWI}
@wiki{BGF}
module language::BGF
alias SGrammar = tuple[set[str] roots, map[str,BGFProdSet] prods];
alias BGFProdList = list[BGFProduction];
alias BGFProdSet = set[BGFProduction];
alias BGFExprList = list[BGFExpression];
alias BGFExprSet = set[BGFExpression];
data BGFGrammar =
grammar (list[str] roots, BGFProdList prods)
;
data BGFProduction =
production (str label, str lhs, BGFExpression rhs)
;
data BGFExpression =
epsilon()
| empty()
| val(BGFValue v)
| anything()
| terminal(str t)
| nonterminal(str t)
| selectable(str selector, BGFExpression expr)
| sequence(BGFExprList exprs)
| choice(BGFExprList exprs)
| allof(BGFExprList exprs) // to cover conjunctive grammars
| marked(BGFExpression expr)
| optional(BGFExpression expr)
| not(BGFExpression expr) // to cover Boolean grammars
| plus(BGFExpression expr)
| star(BGFExpression expr)
| seplistplus(BGFExpression expr, BGFExpression sep)
| sepliststar(BGFExpression expr, BGFExpression sep)
;
data BGFValue = string() | integer();