Chaincode
Jump to navigation
Jump to search
| Paradigm(s) | procedural, imperative |
|---|---|
| Designed by | User:RomanGraef |
| Appeared in | 2017 |
| Computational class | Unknown |
| Reference implementation | Interpreter by Roman Gräf |
| File extension(s) | .chc |
Chaincode is a esoteric language by User:RomanGraef.
Style
At startup the current value is read from STDIN.
A second value is initialised to 0.
Each line is a function:
,#<-call the line below a#<-Adds the input to the current input.
and the first line is the main.
At the end of each line the current value is automatically returned.
The return of main is printed.
Commands
| Command | Exlanation |
|---|---|
+ |
cur++; |
- |
cur--; |
a |
cur+=input(); |
s |
cur-=input(); |
d |
cur*=2; |
h |
cur/=2; |
i |
cur=input(); |
* |
cur*=input(); |
/ |
cur/=input(); |
\ |
cur=input() / cur; |
^ |
cur*=10; |
v |
cur/=10; |
c |
cur=ceil(cur); |
_ |
cur=floor(cur); |
p |
cur=Math.pow(cur,2); |
q |
cur=Math.sqrt(cur); |
, |
cur=line_below(cur); |
! |
cur=factorial(cur); |
= |
cur=(cur==input())?(1.0):(0.0); |
l |
cur=log_2(cur); |
L |
cur=log_10(cur); |
n |
cur=log_E(cur); |
| |
temp=cur; cur=switch; switch=temp; |
> |
switch=cur; |
< |
cur=switch; |
(...) |
Comment |
# |
line comment |
Interpreter
Java Interpreter by Roman Gräf
Examples
Add two numbers
a
Square root
q