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

Sum variants as semantic actions #53

Closed
ptal opened this Issue Aug 9, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@ptal
Owner

ptal commented Aug 9, 2015

expr =
   digit "+" digit > Plus
 / digit "-" digit > Minus

enum BinOp {
  Plus(i32, i32),
  Minus(i32, i32)
}

@ptal ptal changed the title from Sum variant as functions for semantic actions to Sum variants as semantic actions Aug 9, 2015

@ptal

This comment has been minimized.

Show comment
Hide comment
@ptal

ptal Aug 18, 2015

Owner

To avoid declaring enum directly inside the grammar, we could propose "forward" declaration such as:

use enum [path]::{Plus, Minus};
Owner

ptal commented Aug 18, 2015

To avoid declaring enum directly inside the grammar, we could propose "forward" declaration such as:

use enum [path]::{Plus, Minus};

@ptal ptal closed this Jun 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment