mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-28 14:02:50 -06:00
47 lines
1.5 KiB
CFEngine3
47 lines
1.5 KiB
CFEngine3
Grm. Grammar ::= Header ";" Abstract ";" [Concrete] ";" ;
|
|
|
|
Hdr. Header ::= "grammar" CId "(" [CId] ")" ;
|
|
|
|
Abs. Abstract ::= "abstract" "{" [AbsDef] "}" ";" ;
|
|
|
|
Cnc. Concrete ::= "concrete" CId "{" [CncDef] "}" ;
|
|
|
|
Fun. AbsDef ::= CId ":" Type "=" Exp ;
|
|
Lin. CncDef ::= CId "=" Term ;
|
|
|
|
Typ. Type ::= [CId] "->" CId ;
|
|
Tr. Exp ::= "(" Atom [Exp] ")" ;
|
|
AC. Atom ::= CId ;
|
|
AS. Atom ::= String ;
|
|
AI. Atom ::= Integer ;
|
|
trA. Exp ::= Atom ;
|
|
define trA a = Tr a [] ;
|
|
|
|
R. Term ::= "[" [Term] "]" ; -- record/table
|
|
P. Term ::= Term "[" Term "]" ; -- projection/selection
|
|
S. Term ::= "(" [Term] ")" ; -- sequence with ++
|
|
K. Term ::= Tokn ; -- token
|
|
V. Term ::= "$" Integer ; -- argument
|
|
C. Term ::= Integer ; -- parameter value/label
|
|
F. Term ::= CId ; -- global constant
|
|
L. Term ::= "$" CId ; -- local (bound) variable
|
|
A. Term ::= "(" CId "->" Term ")" ; -- lambda abstraction (compressed table)
|
|
FV. Term ::= "[|" [Term] "|]" ; -- free variation
|
|
W. Term ::= "(" String "+" Term ")" ; -- prefix + suffix table
|
|
|
|
KS. Tokn ::= String ;
|
|
KP. Tokn ::= "[" "pre" [String] "[" [Variant] "]" "]" ;
|
|
Var. Variant ::= [String] "/" [String] ;
|
|
|
|
|
|
terminator Concrete ";" ;
|
|
terminator AbsDef ";" ;
|
|
terminator CncDef ";" ;
|
|
terminator CId "" ;
|
|
separator Term "," ;
|
|
terminator Exp "" ;
|
|
terminator String "" ;
|
|
separator Variant "," ;
|
|
|
|
token CId (('_' | letter) (letter | digit | '\'' | '_')*) ;
|