JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

parens don't nominalize a verb #36

Closed ngn closed 8 years ago

ngn commented 8 years ago

According to k.txt a parenthesized expression always parses as a noun:

grammar: E:E;e|e e:nve|te| t:n|v v:tA|{E}|V n:t[E]|(E)|[E]|N

Therefore, I think the following should return 1:

 #,(+)
(#,+)
JohnEarnest commented 8 years ago

That grammar description should be taken with a grain of salt; it omits some details and edge cases which are definitely in the real parser. In the case you point out, though, you are correct. Arthur's interpreter:

 #,(+)
1