Skip to content

Regular.sdf3

pdmosses/sdf/org.metaborg.meta.lang.template/syntax/regular/Regular.sdf3

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
40
41
42
43
44
45
46
47
module 

imports kernel/Kernel constants/IntCon symbols/Symbols constants/StrCon labels/Labels sorts/Sorts

context-free syntax 

// Symbol.Empty = <()>
.Sequence = <(<head:Symbol> <tail:Symbol+>)>
// Symbol.Tuple = <\<<head:Symbol> , <rest:Symbol+; separator=",">\>>


.Opt = <<Symbol>?>
.Iter = <<Symbol>+>
.IterStar = <<Symbol>*>
.IterSep = <{<Symbol> <sep:Separator>}+>
.IterStarSep = <{<Symbol> <sep:Separator>}*>



.Opt = <<Sort>?>
.Iter = <<Sort>+>
.IterStar = <<Sort>*>
.IterSep = <{<Sort> <sep:Separator>}+>
.IterStarSep = <{<Sort> <sep:Separator>}*>
.Lit = <<StrCon>>


 = <<SortSymbol>?> {reject}
 = <<SortSymbol>+> {reject}
 = <<SortSymbol>*> {reject}
 = <{<SortSymbol> <sep:Separator>}+> {reject}
 = <{<SortSymbol> <sep:Separator>}*> {reject}



//Symbol.Func = <(<arguments:Symbols> =\> <results:Symbol>)>
//"left":Symbol "|" "right":Symbol              - > Symbol {right,cons("alt")}
. = <<Symbol> | <Symbol>> {right}
// "(" "left":Symbol "->" "right":Symbol ")"     -> Symbol {cons("strategy")}
//Symbol.Strategy = <(<Symbol> -\> <Symbol> )>

context-free priorities 
{Symbol.Opt
 Symbol.IterStar
 Symbol.Iter} >
 Symbol.Alt >
 Symbol.Label