a smarter lexer brings us down to three shift/reduces

This commit is contained in:
Jeremy Ashkenas
2009-12-16 20:48:37 -05:00
parent 2753648d65
commit 5153ef7c94
4 changed files with 455 additions and 569 deletions

35
code.cs
View File

@@ -1,29 +1,34 @@
# TODO: Add range indexing: array[5..7] => array.slice(5, 7)
# Functions:
square: x => x * x.
# square: x => x * x.
#
# sum: x, y => x + y.
#
# odd: x => x % 2 is 0.
#
# even: x => x % 2 aint 0.
#
# run_loop: =>
# fire_events( e => e.stopPropagation(). )
# listen()
# wait().
#
# # Objects:
# dense_object_literal: {one: 1, two: 2, three: 3}
sum: x, y => x + y.
spaced_out_multiline_object: {
odd: x => x % 2 is 0.
even: x => x % 2 aint 0.
run_loop: =>
fire_events( e => e.stopPropagation(). )
listen()
wait().
# Objects:
object_literal: {one: 1, two: 2, three: 3}
multiline_object: {
pi: 3.14159
list: [1, 2, 3, 4]
three: new Idea()
inner_obj: {
freedom: => _.freedom().
}
}
# Arrays: