Remove repetition from language spec descriptions

This commit is contained in:
Max Brunsfeld 2014-10-19 12:36:43 -07:00
parent 38ad248a53
commit 8134b64d00
14 changed files with 250 additions and 71 deletions

View file

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

View file

@ -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