REALScript

From Esolang
Jump to navigation Jump to search

REALScript is modified version of FakeScript by User:ChuckEsoteric08. Any argument that start with "#" is variable

Commands

Command Meaning
print [arg1] same as in FakeScript
input [arg1] input variable [arg1](arg need to start with "#")
goto [arg1] same as in FakeScript
if [arg1] [arg2] [label] same
!label [label] same(again)
stop stops the program(same, again)
new [arg1] declare variable [arg1] with value 0
set [arg1] [arg2] set variable [arg1] value [arg2]
letter [arg1] [arg2] set variable [arg1] to first letter of [arg2]. If [arg2] was variable, then delete that letter

Examples

Cat

!label 1 
new a 
input #a 
print #a 
goto 1

Hello, World!

print Hello_World!

Truth machine

new a 
input #a 
if #a 1 1 
if #a 0 0  
stop 
!label 1 
print 1 
goto 1 
!label 0 
print 0 
stop

Infinity loop

!label 1 
print Hello_World! 
goto 1

First letter of input

It will ask for input, output first letter of it in first line, and anything else in other

new inp new char input #inp letter char #inp print #char print #inp

Addition

new a 
new b 
new c 
input #a 
input #b 
!label 1 
letter c #a 
if #c ; 2 
print * 
goto 1 
!label 2 
letter c #b 
if #c ; end 
print * 
goto 2 
!label end 
stop

It adds length of two inputs(they need to end with ;, but it not counting) and print * that many times. So if inputs are:

***;
***;

It will print 6 *s

REALScript++

REALScript++ is a REALScript, but with two new commands:

if! [arg1] [arg2] [label] if [arg1] and [arg2] are NOT equal goto label [label]
join [arg1] [arg2] join variable [arg1] and [arg2]([arg2] can be both string and variable)

Interpreters in REALSCript++

+-=

print +-=Interpreter 
print YourCode: 
new code 
new acc 
new t 
new cmd 
input #code 
join code ; 
letter t #acc 
!label run 
letter cmd #code 
if #cmd ; end 
if #cmd + inc 
if #cmd - dec 
if #cmd = out 
goto run 
!label inc 
join acc * 
goto run 
!label dec 
letter t #acc 
goto run 
!label out 
print #acc 
goto run 
!label end 
print CodeExecuted. 

Computational class

Both are Turing complete because you can translate 1-bit BF into that languages, but in REALScript++ you can also make BF with 2 or more bits wide . In REALScript++ you can (maybe) complile Bitwise Cyclic Tag and if you can, it would also make it Turing-complete

External resourses

Scratch interpreter

REALScript++ interpreter