Skip to content

Literals

tkellehe edited this page Nov 7, 2018 · 13 revisions

Literals

unsupported

Numbers

Number objects are created by converting a String literal into a numeric value. This is done using the ȥ token which will take the top of the stack and convert the object into a numeric value and push on a Number object. Now, if the following script is ran “-10.5”ȥ then the output will not be -10.5 but instead the number 1073579251 will be created. This is because the printable characters from ¤ to ~ represent digits for a base 95 number. Therein, to create the number 10 it is “*”ȥ.

For negative numbers, the token Ȥ can be used instead. This will either turn a number negative or convert a String object into a Number as a negative number using base 95 conversion. In order to get decimal numbers, the character can be used which will be counted as the decimal point. (Currently all other will be ignored).

Simple Number Golfing

Since a number will always be a string followed by either ȥ or Ȥ, these tokens will consume all printable characters preceding up to a non-printable character or the start of the program. The single is just a decimal by itself therein will produce zero. So, instead Noodel will interpret as the value 0.5 or the string ¶%.

Less Simple Number Golfing

Since ¤ȥ and ¤Ȥ both produce zero, Noodel will interpret ¤Ȥ as 100 or the string !%. To make use of even more ¤ being present that do not change the resulting value, the following is done:

¤ȥ   => 0
¤¤ȥ  => 1000
¤¤¤ȥ => 10000
...
¤Ȥ   => 100
¤¤Ȥ  => -1000
¤¤¤Ȥ => -10000
...

To go even further:

¤"ȥ   => "ȥ * 100   # Where the `"` can be any base 95 number.
¤¤"ȥ  => "ȥ * 1000  # Where the `"` can be any base 95 number.
¤¤¤"ȥ => "ȥ * 10000 # Where the `"` can be any base 95 number.
...
¤"Ȥ   => "Ȥ * -100   # Where the `"` can be any base 95 number.
¤¤"Ȥ  => "Ȥ * -1000  # Where the `"` can be any base 95 number.
¤¤¤"Ȥ => "Ȥ * -10000 # Where the `"` can be any base 95 number.
...

Also, since ¤¤!ȥ would be the same as ¤¤ȥ we can have even more quick references to numbers:

¤!ȥ   => 0.01
¤¤!ȥ  => 0.001
¤¤¤!ȥ => 0.0001
...
¤!Ȥ   => -0.01
¤¤!Ȥ  => -0.001
¤¤¤!Ȥ => -0.0001
...

Examples

“*”ȥ => 10
*ȥ   => 10
*Ȥ   => -10
¶Ȥ   => -0.5
*¶Ȥ  => -10.5
"\ȥ  => 250
¤9ȥ  => 2500

Strings

String literals start with and end with where any of the following characters can be placed in between:

¶¤!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

These characters are called the printables.

When instantiating a String object it will be pushed to the top of the stack. The characters ¤ and will be interpreted as a space and a new-line respectively. This is because the character is used for separating characters to prevent concatenating commands which can be used to separate String literals. Also, the \n character is a much more complicated it deserves its own page.

Simple String Golfing

Since this is a code-golfing language, there are shorter ways to do strings. The first and most simplest being that if just the starting is present, the parser will continue to consume all printable characters until a non-printable character or end of the program is found. The second is by ending a stream of printable characters with the which will take all printable characters preceding up to a non-printable or start of the program. The last way is that the printable characters ¤ and are only used when creating String objects. Therein, if they are present in a continuous stream of printable characters, the opening and closing quotes are not needed for the String literal.

Examples

“Hello,¤world!” => Hello, world!
Hello,¤world!”  => Hello, world!
“Hello,¤world!  => Hello, world!
Hello,¤world!   => Hello, world!

Arrays

Array objects are created by morphing objects on the stack. The most basic way to create an Array object is by grouping a set of literals.

Then maybe can have shortcuts to get from stack? Might be better to just grab everything on stack up to some point...

⁽!ȥ"ȥ#ȥ$ȥ⁾ => [1, 2, 3, 4]