nandykins/-g-pl — Issue #14: Function call delimiter
Author: nandykins
Created: 2011-11-04 04:55:28+00:00
State: open

On second thought, I'm adding a delimiter to function calls, for which I'll use ‘;’ for now.

The problem is, if the number of parameters for a function determines the way it's parsed, then we need to know the value of a function during the parsing step, which means we can't build a complete AST before execution, so we'd have to parse stuff in realtime.

This causes two drawbacks: 1. We can't use a standard EBNF or Parsec-based parser library, 2. We can't JIT or compile the language at all.

If we introduce a ; as proposed, this gives us several advantages:

1. We can build ASTs, JIT or even compile the language - speeding up execution noticeably in all three cases
2. We can introduce variadic functions or optional parameters very easily

And two cosmetic drawbacks:

1. The syntax is a bit uglier, >mfw "foo"; instead of just >mfw foo
2. We can no longer use ; inside variable names

What do you think? I'm going to add it to the spec for now, since my current implementation breaks / is not really possible otherwise, unless I constantly re-run the parser and move expressions between blocks at runtime, but this would be very hard to do and also very slow.