esseks / monicelli

An esoteric programming language, come se fosse antani.
GNU General Public License v3.0
1.32k stars 52 forks source link

monicelli should accept more keyword #18

Closed melfnt closed 9 years ago

melfnt commented 9 years ago

I tried to write some little programs using this language, like this one: http://pastebin.com/1ejFeQNs that takes in input vassoio and prints the Fibonacci numbers from 0 to vassoio.

Well, I think the supercazzola is not enough fluent, there are a lot of "come se fosse" and "voglio", like in a real c++ program there are a lot of declaration and assignment. In order to make the program more various, I think it must accept more keyword to do the same things and treat the unknown ones as comment.

esseks commented 9 years ago

Adding new keywords means limiting the freedom of the programmer in choosing identifiers. It can be done, but it's an not easy task. I have no proposals at the moment, if you do, please let me know :)

I agree that the syntax is getting somewhat repetitive, but consider that it's still possible to producing nicely flowing supercazzole with the current one, e.g. see what @slattarini did in 080773ed. It involves a bit of effort and not-that-straightforward coding, but it's possible.

Concerning "unknown keywords", there is no way to detect what is "unknown". "unknowns" might be legitimate variable identifiers. The compiler could scan the symbol table to see if a variable which such name is defined, but what if the user simply forgot to declare the variable? "unknowns" might also be syntax errors that must be reported to the user.

We could print a message telling that a token is being ignored. I assure you, that's going to be annoying very soon. One would have to go through the whole set of messages and filter actual syntax errors amid legitimate ignore messages. On the other hand, silently ignoring unknown tokens is a prelude to a whole lot of unexpected behaviours. That's not acceptable.

melfnt commented 9 years ago

I don't think this issue should be closed. If it can't accept "unknown keywords" for the reasons you explained, I think it should accept at least more keywords, and maybe more keywords as comment too.

I also wonder if there was a sign, for example the comma, after that all the words will be considered comments, in order to make the supercazzola more readable.