davidedc / livecodelab

a web based livecoding environment
http://livecodelab.net/
MIT License
327 stars 63 forks source link

Phasing out language version 1 #249

Open rumblesan opened 9 years ago

rumblesan commented 9 years ago

Have we hit feature parity between the two languages yet? so we still need version 1 of the language around? I know that at some point I was talking about the possibility of having multiple languages available, but to be honest, at this point I think it would be better to just concentrate on a single one.

davidedc commented 9 years ago

yes there are several basic tests that don't run the same way on both though.

https://github.com/davidedc/livecodelab/blob/master/coffee/languages/livelangv1/code-preprocessor-tests.coffee

try some of them, the ones that you think should work, cause I remember I found a few surprises back then if I remember well.

(If you don't have time I can run and list the ones that I think should work).

davidedc commented 9 years ago

I went briefly through (the first third of) the tests and played a bit, I noted down these points (in random order):

(there are a couple of example that use times : with the colon, but if I listed such examples here it's because they seem to give trouble with times without the colon as well)

gridSize = 4 * abs(wave 0.05)
box
2+2 times
    rotate box
rotate wave
box
rumblesan commented 9 years ago

ah cool, thanks for going through these, hadn't had a chance yet myself. I think that actually it's worth my going through the grammar again and doing some work the entire thing now my understanding of stuff is a bit better.

rumblesan commented 9 years ago

OK, going through these and seeing what needs doing

So version 2 doesn't support object dereferencing, meanin Math.Pi won't work, but it's easily fixable by adding Pi and all the trig shortcuts to the global scope. Currently I don't think we have a need for using . as an object accessor. Would be a bit of work to add to the language, but not too hard if it's something we need.

closures are something that currently aren't handled, but do need to be done. I'll start on that soon as I've implemented it in other languages before so it's not too tough.

comments do need fixing, not sure why they don't work.

Crazy Ribbon won't work for two reasons. The simpler is just that sin isn't a defined function because the trig stuff hasn't been added to the scope. The more complex issue, and one that's in other places, is that even if sin was then the language doesn't support functions calls in expressions that don't use the parenthesis. for example

pad = 1+abs(2*wave 0.5 )  // invalid
pad = 1+abs(2*wave(0.5)) // valid

functioncalls at the beginning of a line are fine, but not in this case

pretty sure we decided not to go with the colon after times, but that times (using the with or not) does have to be followed by a new line.

also, there's no way the following should be valid, it's really confusing code

a = 2
box a + 3 times rotate peg

Having an expression before times 2+2 times should be fine though and I'll get that fixed.

wave and beat won't work anywhere because they're functions and so in v2 language they need to be invoked with parenthesis.

the ball line box example won't work as I didn't think chaining was meant to work like that. all the chains finish once you have a shape

davidedc commented 9 years ago

converging...

I think it's important though (key, really) to omit the parentheses for function calls (both when there are no arguments and for sure when there are), I'm hoping that's in the realm of possibilities? :8ball:

rumblesan commented 9 years ago

I think I need to have a serious overhaul of the v2 parser and interpreter really. Will start cracking away at it