I've just done some support for "else if" right now, like so:
Code: Select all
HSpeak> if (a) then (b) else if (c) then (d)
root
if
group
val: a
val: b
if
group
val: c
val: d
Code: Select all
>>> (1)
1
>>> (1,)
(1,)
I've put some BSD license in it, just to be sure, but feel free to choose or do whatever you like.
It's ok fast. Consider that I'm working on a Raspberry Pi 3.1k lines per second?
Finally, you may have heard of stuff going on in Italy due to that zombie virus. Internet is ok for now and we're probably going to make it. Just... If I start to turn... Do whatever you need to do.
----
Code: Select all
expression_group : '(' ',' ')'
Code: Select all
HSpeak> (a,,b)
root
group
val: a
none
val: b
I've just added it."do" block not following a for/while/switch
Don't worry too much about:
Code: Select all
WARNING: 110 shift/reduce conflicts
----
Since by law I'm only allowed to program and ****post on 4chan, I wanted to type a little bit more and correct myself. The order in which the rules are defined doesn't matter. In case of a conflict, the rules that match are those that form the longest chain possible and then are reduced right to left, so:
Code: Select all
HSpeak> if (a) then b + 1
root
if
group
val: a
binop: +
val: b
number: 1
Code: Select all
HSpeak> if (a) then b + 1
root
binop: +
if
group
val: a
val: b
number: 1
Anyway. I've explicitly disabled that behavior in the interest of my sanity. I just wanted to let you know it's possible.