tree-sitter/spec/runtime/languages/arithmetic/main.txt
Max Brunsfeld 545e575508 Revert "Remove the separator characters construct"
This reverts commit 5cd07648fd.

The separators construct is useful as an optimization. It turns out that
constructing a node for every chunk of whitespace in a document causes a
significant performance regression.

Conflicts:
	src/compiler/build_tables/build_lex_table.cc
	src/compiler/grammar.cc
	src/runtime/parser.c
2014-09-02 08:03:51 -07:00

49 lines
819 B
Text

====================
parses numbers
===================
5
---
(number)
===================
parses variables
===================
x
---
(variable)
===================
parses products
===================
x * x
---
(product (variable) (variable))
===================
parses sums
===================
x + x
---
(sum (variable) (variable))
===============================================
binds multiplication more tightly than addition
===============================================
a * b + c * d
---
(sum
(product (variable) (variable))
(product (variable) (variable)))
============================
parses exponents
============================
x + y * z^(a + b)
---
(sum
(variable)
(product
(variable)
(exponent
(variable)
(group (sum (variable) (variable))))))