Remove repetition from language spec descriptions
This commit is contained in:
parent
38ad248a53
commit
8134b64d00
14 changed files with 250 additions and 71 deletions
|
|
@ -1,15 +1,21 @@
|
|||
=====================================================
|
||||
recovers from errors at the top level
|
||||
errors at the top level
|
||||
=====================================================
|
||||
|
||||
x * * y
|
||||
|
||||
---
|
||||
|
||||
(variable) (ERROR '*')
|
||||
|
||||
=====================================================
|
||||
recovers from errors inside parenthesized expressions
|
||||
errors inside parenthesized expressions
|
||||
=====================================================
|
||||
|
||||
x + (y * + z) * 5
|
||||
|
||||
---
|
||||
|
||||
(sum
|
||||
(variable)
|
||||
(product (group (ERROR '+')) (number)))
|
||||
|
|
|
|||
|
|
@ -1,52 +1,73 @@
|
|||
====================
|
||||
parses numbers
|
||||
numbers
|
||||
===================
|
||||
|
||||
5
|
||||
|
||||
---
|
||||
|
||||
(number)
|
||||
|
||||
===================
|
||||
parses variables
|
||||
variables
|
||||
===================
|
||||
|
||||
x
|
||||
|
||||
---
|
||||
|
||||
(variable)
|
||||
|
||||
====================================
|
||||
parses variables with greek letters
|
||||
variables with greek letters
|
||||
====================================
|
||||
|
||||
φ1
|
||||
|
||||
---
|
||||
|
||||
(variable)
|
||||
|
||||
===================
|
||||
parses products
|
||||
products
|
||||
===================
|
||||
|
||||
x * x
|
||||
|
||||
---
|
||||
|
||||
(product (variable) (variable))
|
||||
|
||||
===================
|
||||
parses sums
|
||||
sums
|
||||
===================
|
||||
|
||||
x + x
|
||||
|
||||
---
|
||||
|
||||
(sum (variable) (variable))
|
||||
|
||||
===============================================
|
||||
binds multiplication more tightly than addition
|
||||
operators of different precedence
|
||||
===============================================
|
||||
|
||||
a * b + c * d
|
||||
|
||||
---
|
||||
|
||||
(sum
|
||||
(product (variable) (variable))
|
||||
(product (variable) (variable)))
|
||||
|
||||
============================
|
||||
parses exponents
|
||||
exponents
|
||||
============================
|
||||
|
||||
x + y * z^(a + b)
|
||||
|
||||
---
|
||||
|
||||
(sum
|
||||
(variable)
|
||||
(product
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue