Named after the mathematician Emmy Noether, Noether is a RPN (Reverse Polish Notation) stack-based programming language with similarities to the Fourier programming language. In particular, Noether was designed to be a more functional and more useful version of Fourier.
- Online interpreter: https://beta-decay.github.io/noether
- Try it Online: https://tio.run/#noether
To assign a value to a variable, you use the syntax
~i
Where ~
is the assignment function and i
is the variable. This assigns the value on the top of the stack to the variable i
.
If a variable is used that has not been previously assigned to, its value is automatically set to 0
.
Functions have uppercase names so variables must have lowercase names to avoid raising an error.
If statements are defined using curly brackets
If-then
An if-then statement is defined like so:
{<expression>}{<true code>}
If the stack at <expression>
ends at 1, then the code at <true code>
is run. Otherwise, the program continues past the if statement.
If-then-else
An if-then-else statement is defined like so:
{<expression>}{<true code>}{<false code>}
If the stack at <expression>
ends at 1, then the code at <true code>
is run. Otherwise, the code at <false code>
is run.
A loop is defined using parentheses like so:
(<code>)
At the (
, the exit condition for the loop is popped off the stack. If the top of the stack at )
equals the exit condition, then the loop ends and the program continues. Otherwise, the code goes back to (
and it loop again.
These are the functions which exist in Noether. They are subject to change without prior notice.
These functions do not pop anything off the stack
@
- Clears the output screen
%
- Rotates the stack. I.e.
11, 12, 13, 14
becomes14, 11, 12, 13
I
- Pushes the user input
N
- Negates any number which follows it. E.g.
N12P
outputs-12
.
$
- Reverses the stack. I.e.
11, 12, 13, 14
becomes14, 13, 12, 11
?
- Prints a newline
!
- Increments the variable which follows directly after the command (if the variable is a number). If variable had not been previously used, it is set to 1.
All of these functions except P pop the top item off the stack
P
- All types: Prints the top item of the stack
_
- Number: Floors the number and returns the result
- String: Makes all characters in the string lowercase
U
- Number: Ceilings the number and returns the result
- String: Makes all characters in the string uppercase
R
- Number: Returns a random number from 0 to the given number
- String: Shuffles the characters in the string
D
- Number: The number given is the mode number (see Date Modes below) which dicates the part of the date pushed to the stack
;
- Number: Pauses the program for the given number of seconds
L
- Number: Returns the log 10 of the number
- String: Returns the length of the string
#
- All types: Pops the top item off the string and does nothing
W
- Number: Converts number to string
- String: Converts string to number
A
- Number: Returns one of the stored constants according to the mode number (see Constant Modes below)
- String: Returns one of the stored constants according to the mode name (see Constant Modes below)
B
- Number: Returns the character with ASCII code
n
- String: Returns the ASCII code of the first character of the string
All of these functions pop the top two items off the stack
+
- Number and a Number: adds the two numbers and pushes the result
- String and a Number: converts the number to a string, concatenates it to the string and pushes the result
- String and a String: concatenates the strings and pushes the result
-
- Number and a Number: subtracts the two numbers and pushes the result
- String and a Number: deletes the character at the given index and pushes the result
- String and a String: removes characters according to the given regex string from the first string and pushes the result
*
- Number and a Number: Multiplies the two numbers and pushes the result
- String and a Number: String multiplication
/
- Number and a Number: Divides the two numbers and pushes the result
- String and a Number: Pushes the character at the given index of the string
- String and a String: Returns true if the string contains the given substring and false if not
^
- Number and a Number: Raises one number to the power of the other number and returns the result
- String and a String: Splits the first string by the second string and pushes all parts to the stack individually
=
- All types: Returns true if top two items are equal and false if not
>
- Number and a Number: Returns true if the first number is greater than the second number
<
- Number and a Number: Returns true if the first number is less than the second number
&
- All types: Performs a bitwise AND operation on the two top items of the stack
|
- All types: Performs a bitwise OR operation on the top two items of the stack
T
- Number and a Number: The first number is the number which is passed to the trig function, the second is the mode number (see Trig Modes below)
- String and a Number: The number is the number which is passed to the trig function and the string is the mode name (see Trig Modes below)
These functions pop three items off the stack
S
- String, Number A, Number B: Slices the string from position A to position B
The function D pops the mode number off the stack:
- Pushes the number of seconds in the time
- Pushes the number of minutes in the time
- Pushes the number of hours in the time
- Pushes the number of days in the date
- Pushes the number of months in the date
- Pushes the current year
- Pushes the ISO date string
Any other number will mean that D pushes the UNIX timestamp.
The function T pops the number, x and the mode number/name:
- sin: Pushes the sine of x in radians
- cos: Pushes the cosine of x in radians
- tan: Pushes the tangent of x in radians
- asin: Pushes the arcsine of x
- acos: Pushes the arccosine of x
- atan: Pushes the arctangent of x
- DtoR: Converts x from degrees to radians
- RtoD: Converts x from radians to degrees
- pi: Pushes the value of pi (nothing is popped)
- tau: Pushes the value of tau (2*pi) [nothing is popped]
The function A pops the mode number/name:
- alpha: Pushes the string "abcdefghijklmnopqrstvwxyz"
- ALPHA: Pushes the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- nums: Pushes the string "0123456789"
- pi: Pushes the value of pi
- e: Pushes the value of e (the base of the natural logarithm)
"Hello, World!"P
Prints the phrase "Hello, World!".
Explanation:
"Hello, World!" - Push the string "Hello, World!"
P - Print the top of the stack
"~a34BPaP34BPaP"~a34BPaP34BPaP
Outputs its own source code
Explanation:
"~a34BPaP34BPaP"~a - Push the string "~a34BPaP34BPaP" ans stores in the variable a
34BP - Print the character with ASCII code 34 (")
aP - Print the variable a
34BP - Print the character with ASCII code 34 (")
aP - Print the variable a
1~a~bI(aPb+~cb~ac~b?!i)
Outputs the first n
Fibonacci Numbers, where n
is given as input.
Explanation:
1 - Push 1 onto the stack
~a - Store 1 in a
~b - Store 1 in b
I( ) - Loop until the top of the stack equals the input
aP - Print a
b+ - Add a and b
~c - Store the result in c
b~a - Set a equal to b
c~b - Set b equal to c
? - Print a newline
!i - Increment i