Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@csgrammar macro #95

Open
IssaHanou opened this issue Nov 15, 2024 · 0 comments
Open

@csgrammar macro #95

IssaHanou opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@IssaHanou
Copy link
Member

In HerbBenchmarks.PSB2_2021 I tested the merge_grammar function:

function merge_grammar(gs::Vector{ContextSensitiveGrammar})
    grammar_to_construct = ContextSensitiveGrammar()
    for g in gs
        for i in eachindex(g.rules)
            ex = :($(g.types[i]) = $(g.rules[i]))
            add_rule!(grammar_to_construct, ex)
        end
    end
    return grammar_to_construct
end

which originally had grammar_to_construct = @csgrammar begin end
and my tests were failing because a simple test failed because the grammar had 100 rules (like one of the problem grammars was included as well)

                test_g1 = @csgrammar begin
                    Rule = 1
                    Rule = Rule + Rule
                end
                test_g2 = @csgrammar begin
                    Rule = 2
                end
                test_g3 = @csgrammar begin 
                    Rule = 3
                end
                test_full_grammar = merge_grammar([test_g1, test_g2, test_g3])
                @test length(test_full_grammar.rules) == 4
@IssaHanou IssaHanou added the bug Something isn't working label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant