sexps parsing with lex/yacc
12 Nov 2005 16:41:21 -0500

          From comp.compilers

Related articles
sexps parsing with lex/yacc (2005-11-12)
Re: sexps parsing with lex/yacc (2005-11-19)
Re: sexps parsing with lex/yacc (John Millaway) (2005-11-21)
| List of all articles for this month |

Newsgroups: comp.compilers
Date: 12 Nov 2005 16:41:21 -0500
Keywords: parse, question, comment
Posted-Date: 12 Nov 2005 16:41:21 EST

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

(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,
[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.