RockstarLang / rockstar

The Rockstar programming language specification
https://codewithrockstar.com/
MIT License
6.88k stars 222 forks source link

Simple 1-d cellular automata in rockstar #105

Closed Rifhutch closed 6 months ago

Rifhutch commented 6 years ago

https://github.com/Rifhutch/cellular-rocktomata

palfrey commented 6 years ago

Liftin High takes the spirit and greatness doesn't appear to be a valid function declaration as far as I can tell. the spirit is a perfectly good common variable, but greatness isn't either a common or proper variable. The spec describes them as "a list of argument" [sic] and I'm assuming they all need to be variables.

cwfitzgerald commented 6 years ago

@palfrey you're correct, if you change the greatness to Greatness you it will compile fine: webpiler

Rifhutch commented 6 years ago

Yup, the transpiler didn't have a problem with it, but you're right. Fixed to Greatness.

cwfitzgerald commented 6 years ago

@Rifhutch I actually filed https://github.com/yanorestes/rockstar-py/issues/13 about the problem, and he has since fixed it :)

palfrey commented 6 years ago

I'm also fairly sure this isn't compliant as it hit 85070591730234615865843651857942052864 (2^126) at which point my Rust implementation gets unhappy (given that 128-bit integers are the max in the standard library). Given the spec says "Numbers in Rockstar are stored using the DEC64 numeric type" I'm fairly sure this comfortably exceeds what's intended. Python 3 OTOH is perfectly happy with arbitrary-sized numbers...

cwfitzgerald commented 6 years ago

Your right, but to be completely fair, I don't think any of us have implemented proper DEC64 yet, so I don't think this will be easily fixed until we do :)

Connor Fitzgerald Sent from my Phone. Please excuse my brevity.

On July 30, 2018 6:37:24 PM EDT, Tom Parker notifications@github.com wrote:

I'm also fairly sure this isn't compliant as it hit 85070591730234615865843651857942052864 (2^126) at which point my Rust implementation gets unhappy (given that 128-bit integers are the max in the standard library). Given the spec says "Numbers in Rockstar are stored using the DEC64 numeric type" I'm fairly sure this comfortably exceeds what's intended. Python 3 OTOH is perfectly happy with arbitrary-sized numbers...

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/dylanbeattie/rockstar/issues/105#issuecomment-409034580

Rifhutch commented 6 years ago

Definitely exploiting a few features of the target language (python) to use a big integer as a boolean array :)

Rifhutch commented 6 years ago

Although for default settings, the numbers shouldn't get quite that high...possibly another python transpiler quirk was allowing something it shouldn't. @palfrey

yyyyyyyan commented 6 years ago

Sincerely, I'm not planning on implementing DEC64 on rockstar-py. It works well the way it is and it allows more possibilities (without actually affecting on Rockstar code)

palfrey commented 6 years ago

@Rifhutch @yanorestes Also entirely probable there's a bug in my interpreter. I know there's at least one that's stopping other parts of this program so I should prod those first...

Rifhutch commented 6 years ago

@yanorestes More possibilities is totally more rock'n'roll! One thing (that may have already been fixed) is I had an assignment: Davy is without an earlier transpiled that to Davy=0, (aliasing 'without' to a 0-valued expression?), but in this case it should've been Davy=7. That may have produced the exploding values.

yyyyyyyan commented 6 years ago

@Rifhutch from the official README - "As long as the next symbol is not a reserved keyword". without is a reserved keyword simbolizing subtraction, that's why it fails. Davy is nothing is converted to Davy is -, which is then converted to Davy = 0, since the length of alphabetical characters in "-" is 0

Rifhutch commented 6 years ago

@palfrey I also do some hinky arithmetic on strings using '+' to concatenate, I'm guessing that doesn't translate well either.

Rifhutch commented 6 years ago

@yanorestes good point, in this case the quirk was in the webpiler. in any case the assignment was updated to reflect the intended assignment to 0.

palfrey commented 6 years ago

@Rifhutch I've just noticed there's also some stuff where you treat a 0 integer as true specifically If Truth Of The Now taking the soul,the stage. Rewriting it as If Truth Of The Now taking the soul,the stage is nothing works better for me, but we're missing a spec for "truthy" values (I'll file a bug)

Rifhutch commented 6 years ago

@palfrey Cool, removed dependence on truthy integers and put in explicit equality checks.

cwfitzgerald commented 6 years ago

@Rifhutch What is a quirk in the webpiler? If there's a bug, feel free to submit it here :)