aaronryank / Cubically

An esoteric programming language based on Rubik's Cubes
https://github.com/Cubically
GNU General Public License v3.0
28 stars 6 forks source link

added # which allows input to work as an argument to a command #11

Closed rexroni closed 6 years ago

rexroni commented 6 years ago

This pull request only adds one charcter of interpretation.

I put the # character under the "experimental" section of the README, since I feel that is a more appropriate place for it. There might very well be better ways to accomplish the same thing.

aaronryank commented 6 years ago

I'm going to need to modify this a bit, since I don't really like the idea of hardcoding #. The general idea is good, though.

aaronryank commented 6 years ago
if (c == '#') {
    execute(c,-1);
    c = input+'0';
}

^^ won't work if input is a two-digit number. Probably best to add a safety net such as:

if (input <= 7)
    c = input + '0';

Also, make sure c == '#' turns into c == L'#', we're using wide chars.

rexroni commented 6 years ago

When you say you don't really like hardcoding the # character, you mean you don't like the manual check for it before everything else?

I can't say that I do either, but really the sequence of R# would be one command nested within another, and that isn't really handled by the interpreter yet (understandably). It might be worth it / fun to write an interpreter that was more robust, but it would also probably be a lot of work. What do you think?

aaronryank commented 6 years ago

Well, it's not really the interpreter being non-robust that's the problem here, it's just Cubically's syntax itself doesn't quite support that.

Also, while I do like this idea, I don't want to use # as that would make Cubically rather incompatible with polyglots. (I like polyglots.) After I finish Cubically 2 (it's currently in beta and I want to get it out of beta before adding more things to the language), I'll add a character to Cubically's charset and implement it using that instead.

Btw, pretty much all I've got to do to get it out of beta is finish up the issue you opened.

TehPers commented 6 years ago

I like this idea, and I agree that another character could be added to Cubically's charset for this. I think something along the lines of a fancy looking x would work? The issue really is that RLUDFB treat arguments differently than all the operators.

aaronryank commented 6 years ago

I've taken your idea and implemented it using superscript and double-struck numbers. See my comment closing #9.