RE: Build Problems Resolved
Mark S. Miller (markm@caplet.com)
Wed, 01 Sep 1999 12:19:11 -0700
At 09:14 AM 9/1/99 , mzukowski@bco.com wrote:
>What is a quasi-parser?
It is the parser component of a quasi-literal expression or quasi-literal
pattern, as explained by
http://www.erights.org/elang/grammar/quasi-overview.html Briefly, there are
two forms of quasi-parser, a quasi-expression parser and a quasi-pattern
parser.
- A quasi-expression parser responds to 'valueMaker(String)' with a
ValueMaker derived from parsing the string while taking account of embedded
'${<number>}' holes. A ValueMaker responds to 'substitute(List)' with an
object like that described by the original string, but with the elements
from the list substituted in for where the $-holes appeared in the description.
- A quasi-pattern parser responds to 'matchMaker(String)' with a MatchMaker
derived from parsing the string while taking account of embedded
'${<number>}' and '@{<number>}' holes. A MatchMaker responds to
'matchBind(List, Object)' as if by first substituting in the elements of the
list into the $-holes, and then matching the object (the specimen) against
the pattern described by the original string as augmented by the
$-substitution. If the match fails, 'matchBind' returns null. If it
succeeds, it returns a list of values extracted by matching the specimen, in
which each extracted value corresponds to an @-hole.
>How is it different from a parser?
- The input grammar is constrained to recognize $-holes and @-holes, since
the expansion of a quasi-literal will embed these without knowledge of the
syntax of the string that will be parsed.
- The parser and its output must satisfy the one or both of the above two
protocols.
>In the generated code?
Huh?
> From whence this term quasi-parser, any references?
Originally from the "quasi-quote" of the lambda calculus. I think Church
came up with quasi-quote well before Lisp.
>What could you accomplish with a quasi-parser that you can't with a parser?
Let me know if the previous answers have not adequately answered this.
>Are you really asking for an E language code generator?
Not in the same breath. But sure, I'll ask ;)
Cheers,
--MarkM