esseks / monicelli

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

Add strings to Monicelli #19

Open mfortini opened 9 years ago

mfortini commented 9 years ago

I defined a conte Mascetti variable, but I don't know how to assign to it

esseks commented 9 years ago

Simple answer: for now you can't.

As you might have noticed, pointers can be declared using conte. Parsing and emitting support is already in place, but this feature is not documented for a good reason: it's not usable yet. In fact, we still miss a way to use the corresponding & operator. We also miss a way to declare string literals, but I guess that would be pretty easy to solve, since double quotes " could be ok.

Additionally, I would like to introduce a true string type modeled on C++ std::string, instead of ol' C pointers to char arrays. This is certainly something I look forward to implementing and it's already on the way.

mfortini commented 9 years ago

Yes I saw char * are not initialized in any way, so any interaction results to a segfault. Perhaps we could find some start/end tags which are not double quotes to avoid spoiling a supercazzola, something like

voglio ciao, conte Mascetti come dire ciao mondo e basta voglio ciao, conte Mascetti pensava ciao mondo altresì

thank you for Monicelli, it's very fun!

mikyt commented 9 years ago

Hi esseks, Michele here. As one of the authors of the original specification, allow me to say: great job on the implementation! After a couple of years, finally seeing Monicelli actually run is awesome!

Coming back on topic: for & I would suggest "mi porga l'indice". It's used in the first supercazzola of the movie, and it's quite apt for something returning the memory index of the variable. ;-)

And, for quoting the string, instead of using the usual double quotes, we can remember "quintana, o setta", from the scene of the supercazzola in the cemetery, and use "quintana," as the opening token, and ", o setta" as the closing one (please, note the double comma, making the final sentence look much better)

So, an example would be: char *antani = "ciao mondo" equivalent to: voglio antani, conte Mascetti come se fosse quintana, ciao mondo, o setta

What do you think of it?

esseks commented 9 years ago

Hi @mikyt! The quintana/setta way of defining strings is great! Consider it already in the backlog.

As of the mi porga l'indice, mi porga <varname> is already used to read a variable from the user, unfortunately. Granted, the latter is a statement while the former is an expression, so it could work without ambiguities (since "free" expressions are not allowed in Monicelli), but I'd rather avoid using the same token for two unrelated things.

mikyt commented 9 years ago

Cool for the strings! About the other: yes, I know that it is already used, but I was relying exactly on what you just wrote. But I understand you preferring to keep them separate.

giampiero7 commented 9 years ago

I start apologizing about this comment. It's gonna be really annoying, but I have to say it ;P It's about "quintana," and ", o setta": I know the double comma is great to delimit the string itself, but a comma before a conjunction (", o") is not grammatically correct. Please don't kill me about this... I just had to say it... I will accept your decision about it anyway ;)

By the way, AMAZING WORK!

EnlitHamster commented 3 years ago

Hello, I am trying Monicelli out for the first time, and as I cannot find it in the README.md, and this issue is still open, I suppose strings are not yet implemented, right?

Riteo commented 1 year ago

What's the status of this feature? This is literally the only thing stopping me from actually playing with this language.