Gregofi / camel

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

Distinguish more between expressions and statements #31

Closed vlasakm closed 2 years ago

vlasakm commented 2 years ago

See #27. Deliberately not finished, maybe this is not exactly what you want: see the still failing tests and the changed parser states. If you like it, please finish it, otherwise feel free to push here or close the PR entirely.

Gregofi commented 2 years ago

Looking at it and trying to bend the grammar over, it probably doesn't make sense with the semicolons. I'd still like the block being a vector of statements terminated with semicolons and expression at the end (or possibly the expression missing and the value of the block being none). Would you still like to do it (the changes are simple if I understand it right) or should I? Thank you for trying to do it.

vlasakm commented 2 years ago

Please finish it yourself. It seems to me that this should really reflect what you want. I just thought I would bring it some ideas.

Feel free to do anything with the PR.

Gregofi commented 2 years ago

I'll probably close it for now, I implemented the easy changes of the blocks in #32. I'll leave #31 open, but for now I'd left the semicolons as they are, because the grammar gets kinda awkward and the language inconsistent. There is also the javascript way, which tries to insert semicolon if it encounters unexpected token, but I have no idea if lalrpop even supports this, and if it is the right way to go.