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

54 lines
913 B
Text
Raw Normal View History

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