Herb-AI / HerbGrammar.jl

Grammars for Herb.jl
https://herb-ai.github.io/
MIT License
0 stars 2 forks source link

Unexpected behavior when using `@csgrammar` macro with a `:symbol` #68

Open ReubenJ opened 6 months ago

ReubenJ commented 6 months ago

We expect both Symbol("a_symbol") and :a_symbol to work similarly, but the colon variant doesn't currently work:

g_original = @csgrammar begin
     Int = ...
    Ret = Dict(:output1 => Int)
end

When you use this grammar to construct a program, you get something like

Dict{QuoteNode, Int}(:(:output1) => Int)

When we expected

Dict{Symbol, Int}(:output1 => Int)

If you use

g_fixed = @csgrammar begin
     Int = ...
    Ret = Dict(Symbol("output1") => Int)
end

You get the following program

Dict{Symbol, Int}(Symbol("output1") => Int)

Which is what we expected.

TLDR: the two versions of the above grammars should result in the same expression/program