tree-sitter/spec/runtime/languages/arithmetic/main.txt

50 lines
819 B
Text
Raw Normal View History

====================
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))))))