Compile-Time Memoization of Pegged-Generated Parser

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 26 14:31:02 PST 2014


I have working logic for automatic memoization of 
Pegged-generated parsers from Peg grammars here

https://github.com/nordlow/justd/blob/master/firstPegged/source/app.d

Now I wonder if this logic could be modularized in some way 
making it more easy to use (and not so verbose).

The key question is if it's possible to somehow replace

the module ctor at

https://github.com/nordlow/justd/blob/master/firstPegged/source/app.d#L339

that writes the grammar and parser to disk with some automatic 
registration logic.

My plan is to append these to an array of pairs of string at

https://github.com/nordlow/justd/blob/master/firstPegged/source/app.d#L52

that contain file and string to persistently memoized. But when 
uncomment the lines declaring and appending to fileWrites I get a 
compilation error

source/app.d(63): Error: no identifier for declarator fileWrites
source/app.d(63): Error: Declaration expected, not '~='
source/app.d(64): Error: no identifier for declarator fileWrites
source/app.d(64): Error: Declaration expected, not '~='

Have I missed something?

Destroy!


More information about the Digitalmars-d-learn mailing list