sexps parsing with lex/yacc

animesh@neolinuxsolutions.com
12 Nov 2005 16:41:21 -0500

          From comp.compilers

Related articles
sexps parsing with lex/yacc animesh@neolinuxsolutions.com (2005-11-12)
Re: sexps parsing with lex/yacc jburgy@gmail.com (2005-11-19)
Re: sexps parsing with lex/yacc johnmillaway@yahoo.com (John Millaway) (2005-11-21)
| List of all articles for this month |

From: animesh@neolinuxsolutions.com
Newsgroups: comp.compilers
Date: 12 Nov 2005 16:41:21 -0500
Organization: http://groups.google.com
Keywords: parse, question, comment

Hi All:


I need to parse sexps, for example Penn TreeBank output from a program
and need to extract multiple kinds of data from it. An example would
be:


(S1 (S (NP (NNP Foo))
          (VP (AUX is)
            (NP (NP (DT the) (NN CEO)) (PP (IN of) (NP (NNP NeoLinux)))))
          (. .)))


I need to parse this to extract all parse phrases like,


(NP (NNP Foo))
(NNP Foo)
(AUX is)
(VP (AUX is) (NP (NP (DT the) (NN CEO)) (PP (IN of) (NP (NNP NeoLinux))
.....................
And so on.


I am quite new to lex/yacc or flex/bison so I was wondering if anybody
could help with pointers on sexps parsing. Please note that I cannot
use any Lisp or Scheme (which I would have loved to) due to additional
code being done in lex/yacc already and need to do the rest in lex/yacc
as well.


Thanks in advance,
Animesh
[It's trivial to convert the text representation into lists, so I'd do
that, then do simple pattern matching on the lists. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.