18 lines
No EOL
341 B
JavaScript
18 lines
No EOL
341 B
JavaScript
export default grammar({
|
|
name: 'associativity_left',
|
|
|
|
rules: {
|
|
expression: $ => choice(
|
|
$.math_operation,
|
|
$.identifier
|
|
),
|
|
|
|
math_operation: $ => prec.left(seq(
|
|
$.expression,
|
|
'+',
|
|
$.expression,
|
|
)),
|
|
|
|
identifier: $ => /[a-z]+/,
|
|
}
|
|
}); |