Pegged and DMD Compilation Memory

Philippe Sigaud philippe.sigaud at gmail.com
Wed May 23 13:48:50 PDT 2012


On Wed, May 23, 2012 at 5:38 PM, Artur Skawina <art.08.09 at gmail.com> wrote:
> On 05/23/12 17:17, d coder wrote:
>> 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.
>
> It really appears to be that heavy - i once tried to use it for some compile time
> parsing, but it turned out that just importing the module was so expensive (added
> seconds to every compiler invocation, iirc) and it got disqualified before i even
> had a chance to try it...

Yeah, I'm seeing that too. I'm (slooowly) working on another engine
using functions instead of inner classes as now, to see if that
changes anything.

Else, I guess it's possible to generate a parser somewhat akin to
hand-made parsers, with lots of gotos and loops.
> artur


More information about the Digitalmars-d mailing list