Pegged and DMD Compilation Memory
d coder
dlang.coder at gmail.com
Wed May 23 08:17:43 PDT 2012
Greetings
I am trying to use Pegged for compile time parsing. The only issue I am
facing is with the compile time memory. I have a rather simple grammar,
mostly derived from the arithmetic.d example that comes bundled with Pegged.
I am wondering if the memory could be optimized by fine-tuning the code in
the grammar that I have written. I am pasting the code down here for
suggestions. On my 64-bit linux machine my small application is taking as
much as 2.2GB of RAM at the time of compiling the code using DMD 2.059. I
am using the latest Pegged code from github.
Regards
- Puneet
mixin(grammar(
"CstGrammar:
CstSet < Cst+
Cst < Bool ';'
Bool < Comparison BoolExpr*
BoolExpr < ^('&&'/'||') Comparison
Comparison < Expr CompExpr?
CompExpr < ^('<='/'>='/'!='/'<'/'>'/'==') Expr
Expr < Factor AddExpr*
AddExpr < ^('+'/'-') Factor
Factor < Primary MulExpr*
MulExpr < ^('*'/'/') Primary
Primary < Parens / Number / Variable / ^'-' Primary
Parens < '(' Bool ')'
Number <~ [0-9]+
Variable <- Identifier"
));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120523/492b90c7/attachment.html>
More information about the Digitalmars-d
mailing list