Skip to content

Conversation

@brenoafb
Copy link

@brenoafb brenoafb commented Feb 12, 2022

Reading the docs, I felt it was appropriate to have one more example that shows
how to interact with constructors in a common use case: AST parsing.

This PR adds a minimal calculator example.

To run the example, go to the tests/LexAndYaccCalculator directory and run dotnet run.

Comment on lines +15 to +22
%type < Syntax.Expr > start


%%

start: Expr { $1 }

Expr: ID { Var($1) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove start and use Expr as the starting symbol?

Suggested change
%type < Syntax.Expr > start
%%
start: Expr { $1 }
Expr: ID { Var($1) }
%type < Syntax.Expr > Expr
%%
Expr: ID { Var($1) }

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

Successfully merging this pull request may close these issues.

2 participants