Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Implement Top level Language Parser #59

Closed
chase-metzger opened this issue Mar 8, 2022 · 0 comments
Closed

Implement Top level Language Parser #59

chase-metzger opened this issue Mar 8, 2022 · 0 comments

Comments

@chase-metzger
Copy link

Right now I'm trying to implement a simple language parser for a toy language I made up.

Looks something like:

1 + 2; func test(a, b) { return a + b; }
I want to generate a list (aka a vector) of Expr's which is defined very similar to how json_value is defined in the json example.
So the first element in the parsed list would be the 1 + 2 and the second would be the function defintion.

Right now I have a dsl::list(dsl::p<top-level-production-type>, dsl::sep(dsl::newline / dsl::semicolon) as what the rule is for the final production in the grammar.
And the value field is lexy::as_list<ast::ExprList>

The result I am currently getting is only getting the first element parsed. So just 1 +2 or func test(...) if the that's what's first.
How can I modify it so that it collects each type of production/ast type into a list of them?

Repository owner locked and limited conversation to collaborators Mar 11, 2022
@foonathan foonathan converted this issue into discussion #60 Mar 11, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant