ERights Home elang / grammar 
Back to: Primitive Expression Grammar On to: QuasiLiterals

Pattern
Grammar


 

The Such-That Pattern (non associative)

Grammar Meaning Expansion
pattern "?" prefixExpr
If the match succeeds and expr is true
kernel

 

The List Patterns (right associative)

Grammar Meaning Expansion
"[" patt0,... "]" + pattn
match respective elements, and the rest
kernel
"[" patt0,... "]"
match exactly the respective elements
[patt0,...] + ==[]

 

The Exact-Match Pattern (non-associative)

Grammar Meaning Expansion
"==" primExpr
If the match succeeds and expr is true
t ? (t == primExpr)

 

The Quasi-Literal Patterns (non associative)

Grammar Meaning Expansion
parserName`quasi`

Almost literal pattern in an embedded grammar

t ? (quasiParsers["parserName"] \
      matchMaker("quasiString") \
      matchBind([arg,..], t) \
      =~ [patt,...])
`quasi`

Defaults to the "simple" quasi-parser

simple`quasi`

 

The Namer Pattern (non associative)

Grammar Meaning Expansion
varName ":" primExpr

Bind the name to a constructed slot

kernel
varName

no explicit SlotMaker

either
    varName :final
or
    varName :settable
"&" varName

Bind the slot rather than the value

varName : defineSlot
"_"

Matches everything, binds nothing

kernel

 

 

 

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / grammar 
Back to: Primitive Expression Grammar On to: QuasiLiterals
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign