Gregofi / camel

Custom dynamic programming language
MIT License
6 stars 1 forks source link

Simplify grammar and opcode conversion #14

Closed vlasakm closed 2 years ago

vlasakm commented 2 years ago

Note that as before the relational operators (==, <, etc.) are parsed as left associative:

1 < 2 < 3 < 4

is parsed as

(((1 < 2) < 3) < 4)

This may be confusing, since the first operation produces boolean and the rest is thus not really meaningful. But it may be useful for operator overloads.

vlasakm commented 2 years ago

I want to follow up with https://github.com/Gregofi/camel/commit/b73c9ed13d092f418de5cfc729a14419a6adcab4, but I am not sure how merged pull requests interact when they share commits. (I usually prefer "Rebase and merge").

Gregofi commented 2 years ago

This may be confusing, since the first operation produces boolean and the rest is thus not really meaningful. But it may be useful for operator overloads.

This would actually fail at interpreting, since you can't use those operators with operands of different types.

Thank you for the changes! The grammar ones are especially neat.