0

In order to get a complete solution for parsing and analysing an embedded sql code I'd like to know if it is possible to combine two lex|yacc solutions, one for Ansi C and the other for SQL, in the same program. I assume there will be a kind of orchestration between the two grammars.

Sorry if my idea is a little bit ambiguous; as far as proposals come I'll explain more my point of view.

So first of all, my question is: can a parsing solution(lex|yacc or flex|bison) contain more than one lex file and also the same question for a yacc file?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Aymanadou
  • 1,200
  • 1
  • 14
  • 36

1 Answers1

1

You can use the -P option to add a prefix to the generated code and to the file names.

For more information, google for "lex yacc prefix".

Patrick
  • 23,217
  • 12
  • 67
  • 130
  • for a first view it's only for Flex and Bison solution not for lex and yacc. – Aymanadou Jan 03 '12 at 08:53
  • 1
    I see some confusing answers in this identical question: http://stackoverflow.com/questions/730029/is-it-possible-to-have-two-or-more-lex-yacc-parsers-in-the-same-application. Some say that POSIX requires yacc to implement the -p option. Others say that only Flex and Bison support it, not Lex and yacc. You may want to check that other question for more details. – Patrick Jan 03 '12 at 11:02