|prolog and recursive descent parsing? email@example.com (carl immanuel manalo) (2007-09-16)|
|Re: prolog and recursive descent parsing? firstname.lastname@example.org (email@example.com) (2007-09-18)|
|Re: prolog and recursive descent parsing? firstname.lastname@example.org (2007-09-19)|
|Re: prolog and recursive descent parsing? email@example.com (2007-09-21)|
|Date:||Fri, 21 Sep 2007 04:27:31 -0000|
|Posted-Date:||21 Sep 2007 02:21:39 EDT|
On Sep 16, 4:44 pm, carl immanuel manalo <carl_thinks...@yahoo.com>
> How doesprolog use recursive descent parsing to solve problems given
> to it?. Does it make a graph of the parse tree or something?
"Logic Grammars" by Harvey Abramson, Veronica Dahl is a good
reference, although it goes far beyond what most compilers need; one
of the examples involves Latin, where the words can appear in almost
any order (although I seem to remember someone asking how to do that a
little while ago, for declarations ...)
Most parsing in Prolog uses DCG or similar notation. Here's a
Grammar E2 shows how to write an attribute grammar to produce a parse
tree (in Prolog, there's essentially no distinction between an
attribute you bring into a grammar rule and one you emit -- I used
this once to write a parser that could either explain a C declarations
or generate one from pseudo-English).
There are other, more powerful, notations that DCG - DCTG and EDCG
spring to mind. Google can help you find them.
Return to the
Search the comp.compilers archives again.