Closed biscuit314 closed 6 months ago
Corrected some variable capitalization issues but now passes my compiler cleanly
Tommy was a kindle
Jane was gasoline
Put Tommy over Jane into the fire
Put the fire into the daydream
Knock the daydream down
Away takes Time
If Time is nothing
Give back Time
The nightmare was over
Build the nightmare up
If Time is the nightmare
Give back Time
Put Time without the nightmare into my world
Put Time without the fire into Yours
Put Away taking my world into the daylight
Put Away taking Yours into the night
Give back the daylight with the night
Put the daydream into my love
Ever is so rock
Until my love is stronger than Ever
Put Away taking my love into the night
Whisper the night
Build my love up
Thanks for the clean up.
I was testing with the Rockstar to Python transpiler, which required the original capitalization. Which compiler did you use?
My compiler, it is working fully, I am just cleaning it up a little before I post it.
Also Tommy was a kindle
doesn't do what you think it does, it does the following, which is probably not what you meant:
00-18 Program
00-18 | Statement List
00-18 | | Set
00-05 | | | Variable: 'Tommy'
10-18 | | | Variable: 'a:kindle'
Nope, Tommy was a kindle
should set the variable Tommy
to 16
How can the compiler know if you mean that, or you mean to assign a new variable to an old variables value. AFAIK variable arguments are allowed in variable assignment statements.
What do you mean? You can't assign an old variable value to a new variable using was
.
Oh, after another look at the spec, I didn't realize you couldn't put arbitrary expressions on the right hand side of a variable assignment (not a put), that's a bug in my parser, fixing accordingly.
Fixed the parser. The ast is as follows (to look for bugs in either the parser or the program):
000-623 Program
000-623 | Statement List
000-018 | | Set
000-005 | | | Variable: 'Tommy'
010-018 | | | Constant: 16
019-036 | | Set
019-023 | | | Variable: 'Jane'
028-036 | | | Constant: 8
037-070 | | Set
062-070 | | | Variable: 'the:fire'
041-056 | | | Division
041-046 | | | | Variable: 'Tommy'
052-056 | | | | Variable: 'Jane'
071-071 | | None
072-102 | | Set
090-102 | | | Variable: 'the:daydream'
076-084 | | | Variable: 'the:fire'
103-126 | | Decrement
109-121 | | | Variable: 'the:daydream'
127-127 | | None
128-466 | | Function
128-466 | | | Variables
139-143 | | | | Variable: 'Time'
144-466 | | | Statement List
144-178 | | | | If
144-178 | | | | | Conditon
147-162 | | | | | | Equal
147-151 | | | | | | | Variable: 'Time'
155-162 | | | | | | | Null
163-178 | | | | | Statement List
163-177 | | | | | | Return
173-177 | | | | | | | Variable: 'Time'
179-201 | | | | Set
179-192 | | | | | Variable: 'The:nightmare'
197-201 | | | | | Constant: 4
202-224 | | | | Increment
208-221 | | | | | Variable: 'the:nightmare'
225-265 | | | | If
225-265 | | | | | Conditon
228-249 | | | | | | Equal
228-232 | | | | | | | Variable: 'Time'
236-249 | | | | | | | Variable: 'the:nightmare'
250-265 | | | | | Statement List
250-264 | | | | | | Return
260-264 | | | | | | | Variable: 'Time'
266-310 | | | | Set
302-310 | | | | | Variable: 'my:world'
270-296 | | | | | Subtraction
270-274 | | | | | | Variable: 'Time'
283-296 | | | | | | Variable: 'the:nightmare'
311-347 | | | | Set
342-347 | | | | | Variable: 'Yours'
315-336 | | | | | Subtraction
315-319 | | | | | | Variable: 'Time'
328-336 | | | | | | Variable: 'the:fire'
348-390 | | | | Set
378-390 | | | | | Variable: 'the:daylight'
352-372 | | | | | Function:
352-372 | | | | | | Name
352-356 | | | | | | | Variable: 'Away'
352-372 | | | | | | Args
364-372 | | | | | | | Variable: 'my:world'
391-427 | | | | Set
418-427 | | | | | Variable: 'the:night'
395-412 | | | | | Function:
395-412 | | | | | | Name
395-399 | | | | | | | Variable: 'Away'
395-412 | | | | | | Args
407-412 | | | | | | | Variable: 'Yours'
428-465 | | | | Return
438-465 | | | | | Addition
438-450 | | | | | | Variable: 'the:daylight'
456-465 | | | | | | Variable: 'the:night'
467-496 | | Set
489-496 | | | Variable: 'my:love'
471-483 | | | Variable: 'the:daydream'
497-512 | | Set
497-501 | | | Variable: 'Ever'
505-512 | | | Constant: 24
513-513 | | None
514-623 | | Until
514-623 | | | Conditon
520-549 | | | | Greater
520-527 | | | | | Variable: 'my:love'
545-549 | | | | | Variable: 'Ever'
550-623 | | | Statement List
550-588 | | | | Set
579-588 | | | | | Variable: 'the:night'
554-573 | | | | | Function:
554-573 | | | | | | Name
554-558 | | | | | | | Variable: 'Away'
554-573 | | | | | | Args
566-573 | | | | | | | Variable: 'my:love'
589-606 | | | | Print
597-606 | | | | | Variable: 'the:night'
607-623 | | | | Increment
613-620 | | | | | Variable: 'my:love'
Also, about the "correction" of capitalization, I'm not sure it's valid to call a function both capitalized or not. At least, we should have it defined
It isn't valid as I'm assuming function names are just like variables (which allows higher order functions). That was my fault in not catching that in the correction. My parser is parsing it as a way
which isn't correct either. Fixed ast and correction.
I would love to add this to what I'm sure will be a quickly growing collection. Here is my attempt to create (compose?) Fibonacci(25):