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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
imports
{
import Patterns
import CommonTypes
import Data.Map(Map)
import Data.Set(Set)
}
DATA CGrammar
| CGrammar typeSyns : {TypeSyns}
derivings : {Derivings}
wrappers : {Set NontermIdent}
nonts : CNonterminals
pragmas : {PragmaMap}
paramMap : {ParamMap}
contextMap: {ContextMap}
quantMap : {QuantMap}
aroundsMap: {Map NontermIdent (Map ConstructorIdent (Set Identifier))}
mergeMap : {Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier,[Identifier])))}
multivisit : {Bool}
TYPE CNonterminals = [CNonterminal]
DATA CNonterminal
| CNonterminal nt : NontermIdent
params : {[Identifier]}
inh : Attributes
syn : Attributes
prods : CProductions
inter : CInterface
DATA CInterface
| CInterface seg:CSegments
TYPE CSegments = [CSegment]
DATA CSegment
| CSegment inh : Attributes
syn : Attributes
TYPE CProductions = [CProduction]
DATA CProduction
| CProduction con : ConstructorIdent
visits : CVisits
children : {[(Identifier,Type,ChildKind)]}
terminals : {[Identifier]}
TYPE CVisits = [CVisit]
DATA CVisit
| CVisit inh : Attributes
syn : Attributes
vss : Sequence -- sequence of "steps", where each "step" is either an attribute definition or a child visit
intra : Sequence -- how to glue the visits together (child visits are child-intra's, attr-defs are attr-intra's)
ordered : Bool -- indicates that vss is ordered
TYPE Sequence = [CRule]
DATA CRule
| CRule name : Identifier
isIn : Bool -- True iff there is a definition for an inherited attribute
hasCode : Bool -- True iff there is an RHS
nt : NontermIdent
con : ConstructorIdent
field : Identifier
childnt : {Maybe NontermIdent} -- Just n: 'field' of 'nt' and 'con' is a nonterminal 'n', Nothing: it is a terminal
tp : {Maybe Type} -- type of the attribute
pattern : Pattern -- only defined if 'isIn' is False
rhs : {[String]} -- empty string if 'hasCode' is False
defines : {Map Int (Identifier,Identifier,Maybe Type)} -- the attributes defined by this rule
owrt : {Bool}
origin : String -- just for documentation (and maybe errors)
uses : {Set (Identifier, Identifier)}
explicit : Bool -- True if this an explicit rule found in the source file
mbNamed : {Maybe Identifier}
| CChildVisit name : Identifier -- corresponding to the name of the child
nt : NontermIdent
nr : Int -- visit number
inh : Attributes
syn : Attributes
isLast : Bool -- indicates whether this is the last visit to this child
SET AllCodeSyntax
= CGrammar
CNonterminal CNonterminals
CInterface CSegments CSegment
CProduction CProductions
CVisits CVisit
CRule
|