All these errors running basic Pegged helloworld example.
Enjoys Math
enjoysmath at gmail.com
Fri Jan 11 17:35:40 UTC 2019
On Sunday, 27 September 2015 at 07:16:51 UTC, BBasile wrote:
> On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote:
>> The example is:
>>
>> import pegged.grammar;
>>
>> mixin(grammar(`
>> Arithmetic:
>> Term < Factor (Add / Sub)*
>> Add < "+" Factor
>> Sub < "-" Factor
>> Factor < Primary (Mul / Div)*
>> Mul < "*" Primary
>> Div < "/" Primary
>> Primary < Parens / Neg / Pos / Number / Variable
>> Parens < "(" Term ")"
>> Neg < "-" Primary
>> Pos < "+" Primary
>> Number < ~([0-9]+)
>>
>> Variable <- identifier
>> `));
>>
>> I'm using Visual D and have C:\MyProjects\D\Pegged (the git
>> clone of pegged) added to the add'l imports field under
>> project properties > compiler.
>>
>> I'm getting errors like these:
>>
>> Error 1 Error 42: Symbol Undefined
>> _D6pegged7dynamic7grammar7grammarFAyaHAyaDFS6pegged3peg9ParseTreeZS6pegged3peg9ParseTreeZS6pegged7dynamic7grammar14DynamicGrammar (pegged.dynamic.grammar.DynamicGrammar pegged.dynamic.grammar.grammar(immutable(char)[], pegged.peg.ParseTree delegate(pegged.peg.ParseTree)[immutable(char)[]])) C:\MyProjects\D\PeggedPractice\
>> Error 2 Error 42: Symbol Undefined
>> _D6pegged7dynamic7grammar12__ModuleInfoZ C:\MyProjects\D\PeggedPractice\
>>
>> The # of errors was greatly reduced when I added the 3 pegged
>> source files to my project. What can be going wrong? Thanks!
>
> You must also pass the source root with -I:
>
> -IC:\MyProjects\D\Pegged
>
> (and maybe you miss another source since there are 5:
>
> '..\repos\Pegged\pegged\grammar.d'
> '..\repos\Pegged\pegged\parser.d'
> '..\repos\Pegged\pegged\peg.d'
> '..\repos\Pegged\pegged\dynamic\grammar.d'
> '..\repos\Pegged\pegged\dynamic\peg.d'
> )
>
> By the way with Coedit you wouldn't have this kind of problems
> (Pegged is part of metaD). You can even run some test on Pegged
> without saving the file / without a project (this is called a
> runnable module). This is just what I've done.
>
> At least compile pegged as a static lib, then it's simpler, you
> just have to pass the -I<root> pegged.lib and your custom
> sources files.
Thanks, I downloaded Coedit, but it's not working with pegged
(using the library manager dub button)
More information about the Digitalmars-d-learn
mailing list