-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestexploratoryWe might do it, pending investigationWe might do it, pending investigation
Description
Consider an interface like this for setting up a TDOP with Pratt:
var parser = OperatorPrecidence(c => c
.Level(l => l
.Left(Number())
)
.Level(l => l
.Left(Match('-'), (ctx, state, token) => { ... })
)
.Level(l => l
.Right(Match('+'), (ctx, state, token) => { ... })
.Right(Match('-'), (ctx, state, token) => { ... })
)
.Level(l => l
.Right(Match('*'), (ctx, state, token) => { ... })
.Right(Match('/'), (ctx, state, token) => { ... })
)
.Level(l => l
.RightAssociative(r => r
.Right(Match('.'), (ctx, state, token) => { ... })
)
)
);With a setup like this, we don't have to manually change precedence levels every time we want to insert something into the table, we just add a new .Level() call and everything just works. Need to do some work on the Left/Right associativity though.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestexploratoryWe might do it, pending investigationWe might do it, pending investigation