Skip to content

Commit

Permalink
wip ebnf
Browse files Browse the repository at this point in the history
  • Loading branch information
ghewgill committed Feb 15, 2024
1 parent 239dea2 commit 3958c16
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions contrib/grammar/neon.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -157,29 +157,33 @@ WhileStatement = 'WHILE', ExpressionOrValid, ['LABEL', Identifier], 'DO', {State
ExpressionOrValid = Expression | ('VALID', (Identifier | (Expression, 'AS', Identifier)), {',', (Identifier | (Expression, 'AS', Identifier))});
BracketedExpression = ConditionalExpression | TryExpression | DisjunctionExpression;
BracketedExpression = ConditionalExpression | TryExpression | LogicalExpression;
ConditionalExpression = ('IF', Expression, 'THEN', Expression, 'ELSE', Expression);
TryExpression = ('TRY', Expression, {'TRAP', Identifier, ['.', Identifier], ['AS', Identifier], (('DO', {Statement}) | 'GIVES', Expression)});
Expression = DisjunctionExpression;
Expression = LogicalExpression;
DisjunctionExpression = ConjunctionExpression, {'OR', ConjunctionExpression};
LogicalExpression = MembershipExpression, [ DisjunctionExpressionChain | ConjunctionExpressionChain ];
ConjunctionExpression = MembershipExpression, {'AND', MembershipExpression};
DisjunctionExpressionChain = 'OR', MembershipExpression, {'OR', MembershipExpression};
ConjunctionExpressionChain = 'AND', MembershipExpression, {'AND', MembershipExpression};
MembershipExpression = TypeTestExpression, [('IN' | 'NOT', 'IN'), TypeTestExpression];
TypeTestExpression = ComparisonExpression, ['ISA', Type];
ComparisonExpression = AdditionExpression, {('=' | '<>' | '<' | '>' | '<=' | '>='), AdditionExpression};
ComparisonExpression = ArithmeticExpression, {('=' | '<>' | '<' | '>' | '<=' | '>='), ArithmeticExpression};
ArithmeticExpression = CompoundExpression, [ AdditionExpressionChain | ConcatExpressionChain | MultiplicationExpressionChain | (('-' | '/' | 'INTDIV' | 'MOD' | '^'), CompoundExpression) ];
AdditionExpression = MultiplicationExpression, {('+' | '-' | '&'), MultiplicationExpression};
AdditionExpressionChain = '+', CompoundExpression, {'+', CompoundExpression}, ['-', CompoundExpression];
MultiplicationExpression = ExponentiationExpression, {('*' | '/' | 'INTDIV' | 'MOD'), ExponentiationExpression};
ConcatExpressionChain = '&', CompoundExpression, {'&', CompoundExpression};
ExponentiationExpression = CompoundExpression, {'^', CompoundExpression};
MultiplicationExpressionChain = '*', CompoundExpression, {'*', CompoundExpression}, ['/', CompoundExpression];
Atom =
('(', BracketedExpression, ')') |
Expand Down

0 comments on commit 3958c16

Please sign in to comment.