Valence is a programming language where each symbol is a homophone with multiple meanings. Context determines the meaning of the symbol; if multiple readings remain, each interpretation plays out in parallel.
In Valence:
- Any symbol can be read as a variable name, an octal digit, a command, a type, or an expression
- For commands and expressions, most symbols have multiple interpretations based on parameter count
- Every possible reading of a program plays out in parallel
- Brackets can disambiguate a phrase when needed
There is no single line of Valence that isn't valid; any combination of the signs has multiple meanings. However, some programs have mismatched brackets or (detectable) infinite loops; during execution, these are skipped.
Project Status
Feel free to open issues or add failing tests for anything not already there. Here are the major things still in progress.
IN PROGRESS:
- INPUT (currently non-functional)
- Support for TRADE OPERATION in the interpreter
- Full testing of Queue and casting
- Some display fixes
Instructions
Each instruction is a single letter, borrowed from Ancient Greek numbering and measuring signs. While there is some association between some borrowed signs and usage, they all mean something significantly different in Valence.
| symbol | typed as | interpretation | type | params |
|---|---|---|---|---|
| π Ά | q | 0 | octal digit | 0 |
| π Ά | var | 0 | ||
| int | type | 0 | ||
| not | exp | 1 (exp) | ||
| add | exp | 2 (exp, exp) | ||
| while | cmd | 1 (exp) | ||
| add_assign | cmd | 2 (var, exp) | ||
| π | w | 1 | octal digit | 0 |
| π | var | 0 | ||
| read_as_digit | exp | 1 (digit) | ||
| subtract | exp | 2 (exp, exp) | ||
| if | cmd | 1 (exp) | ||
| while_queue | cmd | 2 (var, exp) | ||
| π Ύ | e | 2 | octal digit | 0 |
| π Ύ | var | 0 | ||
| read_as_var | exp | 1 (var) | ||
| div | exp | 2 (exp, exp) | ||
| end block | cmd | 0 | ||
| goto | cmd | 1 (exp) | ||
| trade_op | cmd | 2 (var, range): CURRENTLY IN PROGRESS | ||
| π | a | 3 | octal digit | 0 |
| π | var | 0 | ||
| queue | type | 0 | ||
| equals | exp | 2 (exp, exp) | ||
| cmd | 1 (exp) | |||
| π | s | 4 | octal digit | 0 |
| string | type | 0 | ||
| int_or_floor | exp | 1 (exp) | ||
| cast | exp | 2 (type, exp) | ||
| label | cmd | 1 (var) | ||
| assign | cmd | 2 (var, exp) | ||
| π » | d | 5 | octal digit | 0 |
| π » | var | 0 | ||
| char | type | 0 | ||
| mult_by_eight | exp | 1 (exp) | ||
| get_element (from queue) | exp | 2 (exp, exp) | ||
| jump | cmd | 1 (exp) | ||
| append | cmd | 2 (var, exp) | ||
| π | z | 6 | octal digit | 0 |
| π | var | 0 | ||
| bool | type | 0 | ||
| or | exp | 2 (exp, exp) | ||
| else | cmd | 0 | ||
| else_if | cmd | 1 (exp) | ||
| π | x | 7 | octal digit | 0 |
| π | var | 0 | ||
| ratio | type | 0 | ||
| dequeue | var | 1 | ||
| mul | exp | 2 (exp, exp) | ||
| input | cmd | 1 (var) | ||
| mul_assign | cmd | 2 (var, exp) | ||
| [ | [ | begin lexical group | ||
| ] | ] | end lexical group |
Example Programs
Hello World (with single interpretation)
[π]π[[π
»]π[[π
»[π
»[ππ]]]π
Ά[π
»[ππ]]]]
[π
Ά]π[π
Ύπ]
[π]π
Ά[[π
»[ππ]]π
Ά[ππ
»]]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[ππ]
[π
Ά]π
»[π
Ύπ]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[ππ]
[π
Ά]π
»[π
Ύπ]
[π
Ύπ]π[π
»[ππ]]
[π
Ά]π
Ά[π
Ύπ]
[π]π[[[π
»[π
»[ππ]]]π
Ά[π
»[ππ
Ύ]]]π
Ά[ππ]]
[π
Ά]π
»[π
Ύπ]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[ππ]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[π
Ά[π[π]]]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[π
Ά[π
»[ππ]]]
[π
Ά]π
»[π
Ύπ]
π[π
Ύπ
Ά]
Hai / Bye
This program has two executions, one producing "Hai", the other "Bye":
[π
Ά]πππ
[π]π[ππ]
[π]π[π
Ά]
π
Ύ[π[[π
Ύπ]π
Ά[ππ
»]]]
π[π
»]
[π]π
Ά[[ππ
Ά]π[ππ
Ύ]]
π[π]
[π]π[[π
»]π[[[π
»[π
»[ππ]]]π
Ά[ππ
»]]π
Ά[[π
Ύπ]π[ππ]]]]
[π
Ά]π[π
Ύπ]
[π]π
Ά[π
»[ππ
»]]
[π]π
Ά[[ππ
Ά]π[[[π
»[ππ]]π
Ά[ππ]]π[π
Ύπ]]]
[π
Ά]π
»[π
Ύπ]
[π]π
Ά[[ππ
Ά]π[ππ]]
[π]π
Ά[[[π
»[ππ]]π
Ά[ππ]]π[π
Ύπ]]
[π
Ά]π
»[π
Ύπ]
π[π
Ύπ
Ά]
The program splits in line 3:
π
Ά = 1
π = 1
π = π
Ά (for Bye) | π = 0 (for Hai)
goto((π + 0o5))
set_label(π
»)
π += (0 - 0o2)
set_label(π)
π = cast(char, (0o105 + (π * 0o3)))
π
Ά = π
π += 0o50
π += (0 - (0o17 * π))
π
Ά APPEND π
π += (0 - 0o6)
π += (0o16 * π)
π
Ά APPEND π
print(π
Ά)