module lang::aterm::\syntax::ATerm
rascal-0.40.16
Usage
import lang::aterm::\syntax::ATerm;
syntax AFun
syntax AFun = Quoted: StrCon |
Unquoted: IdCon
;
syntax ATerm
syntax ATerm = Int: IntCon |
Real: RealCon |
Fun: AFun |
Appl: AFun "(" {ATerm ","}+ ")" |
Placeholder: "\<" ATerm "\>" |
List: "[" {ATerm ","}* "]" |
Annotated: ATerm Annotation
;
syntax Annotation
syntax Annotation = Default: "{" {ATerm ","}+ "}"
;
syntax IntCon
syntax IntCon = Natural: NatCon |
Positive: "+" NatCon |
Negative: "-" NatCon
;
syntax RealCon
syntax RealCon = RealCon: IntCon "." NatCon OptExp
;
syntax OptExp
syntax OptExp = Present: "e" IntCon |
Absent:
;
syntax NatCon
lexical NatCon = Digits: [0-9]+ !>> [0-9];
syntax StrChar
lexical StrChar = NewLine: [\\] [n]
| Tab: [\\] [t]
| Quote: [\\] [\"]
| Backslash: [\\] [\\]
| Decimal: [\\] [0-9] [0-9] [0-9]
| Normal: ![\n\t\"\\]
;
syntax StrCon
lexical StrCon = Default: [\"] StrChar* [\"]
;
syntax IdCon
lexical IdCon = Default: [A-Za-z] [A-Za-z\-0-9]* !>> [A-Za-z\-0-9];