|extending a grammar email@example.com (1996-03-12)|
|Re: extending a grammar firstname.lastname@example.org (1996-03-21)|
|Re: extending a grammar email@example.com (1996-03-25)|
|Re: extending a grammar firstname.lastname@example.org (1996-03-27)|
|Re: extending a grammar email@example.com (1996-03-27)|
|RE: extending a grammar VIC@edge.paragraph.com (Zhukov Victor) (1996-03-27)|
|From:||firstname.lastname@example.org (M.M. van der Laan)|
|Date:||12 Mar 1996 21:48:16 -0500|
Programming languages are never be flexible enough to cover all
programming tasks. Off course, libraries of functions cover most
problems, but sometimes one just needs a better grammar.
A solution might be to be able to expand the grammar by means of some
EBNF notation, written in the language itself. The compiler could
translate this EBNF and add it to it's own parser tables.
For instance, to allow inline SQL the syntax could be extended
grammar ; a reserved word to start EBNF
statement = sql_select ; add select statement to grammar
sql_select = 'SELECT' etc...
(rest of code not shown)
The EBNF can contain function calls (as in a normal parser
specification) to the internal parser, which has to be part of the
language, off course.
Has anyone done this / thought of this / seen this before? Any remarks?
Mauk van der Laan
[Extensible languages like this were quite popular in the early 1970s,
letting you define new syntax which mapped into macros or the like.
They were awful to use, because no two programs used the same syntax,
and there were always lots of little packages of syntactic sugar. OOP
is kind of the flip side of the same idea, keeping the syntax the same
but adding new semantics. -John]
Return to the
Search the comp.compilers archives again.