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.

Reply via email to