On the topic of replacing alloca by malloc.

wjw@eb.ele.tue.nl (Willem Jan Withagen)
Wed, 8 Jan 92 11:30:45 +0100

          From comp.compilers

Related articles
WIN3 LEX&YACC PORT droland@eng.auburn.edu (David A. Roland) (1992-01-06)
On the topic of replacing alloca by malloc. wjw@eb.ele.tue.nl (1992-01-08)
| List of all articles for this month |

Newsgroups: comp.compilers
From: wjw@eb.ele.tue.nl (Willem Jan Withagen)
Keywords: C, storage, MSDOS
Organization: Compilers Central
References: 92-01-023
Date: Wed, 8 Jan 92 11:30:45 +0100

In article 92-01-023, droland@eng.auburn.edu (David A. Roland) writes:
=> >Has anybody ever ported LEX & YACC generated C code to MS Windows.
=> >Is it possible to do such thing?
=> 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."

It sort of boils down to the discussion we've just finished. When I did
this in TURBO C I could not "self" alloca the pushdown stacks as regular
arrays because the stack is very limited. So then I indeed replace alloca
with malloc, but you then have to modify the exit code as well, and have
them free the occupied space.

So I've hacked the skeleton a little. I've placed it under anon-ftp
at: ftp.eb.ele.tue.nl[]
in: /pub/local-dos/gnu/simple.bsn

Willem Jan Withagen
Eindhoven University of Technology DomainName: wjw@eb.ele.tue.nl
Digital Systems Group, Room EH 10.10
P.O. 513 Tel: +31-40-473401
5600 MB Eindhoven The Netherlands

Post a followup to this message

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