Greetings<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Regards</div><div>- Puneet</div><div><br></div><div><div>mixin(grammar(</div><div> "CstGrammar:</div><div> CstSet < Cst+</div><div> Cst < Bool ';'</div><div> Bool < Comparison BoolExpr*</div>
<div> BoolExpr < ^('&&'/'||') Comparison</div><div> Comparison < Expr CompExpr?</div><div> CompExpr < ^('<='/'>='/'!='/'<'/'>'/'==') Expr</div>
<div> Expr < Factor AddExpr*</div><div> AddExpr < ^('+'/'-') Factor</div><div> Factor < Primary MulExpr*</div><div> MulExpr < ^('*'/'/') Primary</div>
<div> Primary < Parens / Number / Variable / ^'-' Primary</div><div> Parens < '(' Bool ')'</div><div> Number <~ [0-9]+</div><div> Variable <- Identifier"</div>
<div>));</div></div><div><br></div>