Thread overview
All these errors running basic Pegged helloworld example.
Sep 27, 2015
Enjoys Math
Sep 27, 2015
BBasile
Jan 11, 2019
Enjoys Math
Jan 11, 2019
0xEAB
Jan 11, 2019
Michelle Long
Jan 11, 2019
Enjoys Math
September 27, 2015
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!

September 27, 2015
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.
January 11, 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)
January 11, 2019
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 need to add most of the pegged files... there are more than 3. Try adding them all first then remove the junk like the examples, docs, etc until it works.
January 11, 2019
On Friday, 11 January 2019 at 17:44:33 UTC, Michelle Long wrote:
> On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote:
>> [...]
>
> You need to add most of the pegged files... there are more than 3. Try adding them all first then remove the junk like the examples, docs, etc until it works.

Why should I do that?  There's a DUB feature in Coedit... it should work!
January 11, 2019
On 1/11/19 1:21 PM, Enjoys Math wrote:
> On Friday, 11 January 2019 at 17:44:33 UTC, Michelle Long wrote:
>> On Sunday, 27 September 2015 at 06:30:37 UTC, Enjoys Math wrote:
>>> [...]
>>
>> You need to add most of the pegged files... there are more than 3. Try adding them all first then remove the junk like the examples, docs, etc until it works.
> 
> Why should I do that?  There's a DUB feature in Coedit... it should work!

Just keep in mind folks, that the post replied to was from September 2015.

-Steve
January 11, 2019
On Friday, 11 January 2019 at 17:35:40 UTC, Enjoys Math wrote:
> Thanks, I downloaded Coedit, but it's not working with pegged (using the library manager dub button)

According to your post in [0], it didn't work because you had a typo in `pegged`.
Maybe correct it and try again :)

 - Elias


[0] https://forum.dlang.org/thread/yhftsrkylskbigoanzlb@forum.dlang.org