Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lex and Yacc without Dynamic Memory Allocation

I'm in the process of designing software to run in an embedded environment where the use of dynamic memory is prohibited. Lex and Yacc are well suited for the application.

Can I configure Lex and Yacc to not use dynamic memory allocation at all?

Can I configure Lex and Yacc to use a predefined block of memory and therefor limit dynamic memory usage to that predefined space?

Can I limit the use of dynamic memory to program initialization only (i.e. when the program first runs)?

edit: In response to TonyK, I want the parser to not use dynamic memory.

Thank you

like image 233
Chris G Avatar asked Jan 10 '11 16:01

Chris G


1 Answers

Sure you can, if you can compile Lex and Yacc yourself. You just have to implement your own malloc and free, and link to those. (Assuming Lex and Yacc are pure C, which I think is the case.)

Edit Have I misunderstood yet another question? Do you want Lex and Yacc themselves to use a limited amount of memory, or do you want them to generate parsers that use a limited amount of memory?

like image 101
TonyK Avatar answered Sep 30 '22 09:09

TonyK