David A. Roland <>
Mon, 6 Jan 92 23:59:44 CST

          From comp.compilers

Related articles
LEX & YACC code port to MS Windows (1992-01-03)
WIN3 LEX&YACC PORT (David A. Roland) (1992-01-06)
On the topic of replacing alloca by malloc. (1992-01-08)
| List of all articles for this month |

Newsgroups: comp.compilers
From: David A. Roland <>
Keywords: lex, yacc
Organization: Compilers Central
References: 92-01-014
Date: Mon, 6 Jan 92 23:59:44 CST

>Has anybody ever ported LEX & YACC generated C code to MS Windows.
>Is it possible to do such thing?

I have written a few applications which run under Windows 3.0 and use the
code generated by Lex/Yacc||Flex/Bison. These have been fairly big, using
a full ANSI C grammar.

All I had to do was open files and call yyparse() from the windows app.
Just get rid of all the printf()'s first, and if you use code generated by
BISON redefine "alloca" as "malloc."

(I don't know if this is a correct substitution but it works.)

BTW:I did all of this under Quick C for Windows and just inserted the
yyparse() call in the code generated by QuickCase:W and include the yacc
and lex code in the project make.

So you shouldn't have much trouble doing a port. Feel free to email me if
you have any other questions.


Post a followup to this message

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