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

Proper use of the Hime SDK #109

Open
xuanbachle opened this issue Jul 24, 2024 · 0 comments
Open

Proper use of the Hime SDK #109

xuanbachle opened this issue Jul 24, 2024 · 0 comments

Comments

@xuanbachle
Copy link
Contributor

xuanbachle commented Jul 24, 2024

I can not get the SDK CompilationTask to work properly to generate an in memory parser for the MathExp.gram example. I keep getting: ParseErrors { errors: [UnexpectedToken(ParseErrorUnexpectedToken { position: TextPosition { line: 1, column: 1 }, length: 1, value: "1", terminal: Symbol { id: 7, name: "NUMBER" }, expected: [Symbol { id: 17, name: "-" }] })] }

when I tried to use the in memory parser to parse a simple "1 + 2" input. Part of my code to get the in memory parser is below:

                        let data = l.grammars[0].build(Some(ParsingMethod::LR1), 0);
                        //println!("{:?}", data);
                        match data {
                            Ok(d) => {
                                match output::build_in_memory_grammar(&l.grammars[0], &d) {
                                    Ok(parser) => {

                                        let res = parser.parse("1 + 2");
                                        println!("{:?}", res.errors);
                                        print(res.get_ast().get_root(), &[]);

What should I do to get this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant