Valence

From Esolang
Jump to navigation Jump to search

Valence is a programming language that brings the expressiveness of spoken language to code. Specifically, it adds two things: homonymy and structural ambiguity.

Concept

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

Lexicon

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
𐅢 var
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
𐆇 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
𐅾 var
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
𐆋 var
queue type 0
equals exp 2 (exp, exp)
print 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
𐅻 var
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
π†Š var
bool type 0
or exp 2 (exp, exp)
else cmd 0
else_if cmd 1 (exp)
𐆁 x 7 octal digit
𐆁 var
ratio type
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)

[𐆋]𐆉[[𐅻]𐆉[[𐅻[𐅻[𐆇𐆇]]]𐅢[𐅻[𐆇𐆇]]]]
[𐅢]𐆉[𐅾𐆋]
[𐆋]𐅢[[𐅻[𐆇𐆋]]𐅢[𐆇𐅻]]
[𐅢]𐅻[𐅾𐆋]
[𐆋]𐅢[𐆇𐆁]
[𐅢]𐅻[𐅾𐆋]
[𐅢]𐅻[𐅾𐆋]
[𐆋]𐅢[𐆇𐆋]
[𐅢]𐅻[𐅾𐆋]
[𐅾𐆉]𐆉[𐅻[𐆇𐆉]]
[𐅢]𐅢[𐅾𐆉]
[𐆁]𐆉[[[𐅻[𐅻[𐆇𐆇]]]𐅢[𐅻[𐆇𐅾]]]𐅢[𐆇𐆁]]
[𐅢]𐅻[𐅾𐆁]
[𐅢]𐅻[𐅾𐆋]
[𐆋]𐅢[𐆇𐆋]
[𐅢]𐅻[𐅾𐆋]
[𐆋]𐅢[𐅢[𐆇[π†Š]]]

Links