Skip to content

Latest commit

 

History

History
137 lines (131 loc) · 12.7 KB

bytecode.md

File metadata and controls

137 lines (131 loc) · 12.7 KB

Documentation

Bytecode

When you compile a BIPLAN program with BCC, you are just translating your program in a more compact form designed to be efficiently interpreted.

For example, this is a short BIPLAN program of 45 characters:

print "Hello World!"
@a = 3 + 3
print @a
stop

This is the program above compiled in 24 characters of BIP bytecode:

p"Hello World!"}$3+3p}$x

When executed prints:

Hello World!6

The BIP bytecode is just an ASCII string, so it does not require any tool to browse it, analize it or transmit it. BIP bytecode is saved in .bip files, that can be browsed as any other text file.

Using the ASCII encoding and representing addresses with one character restricts their number to 88. The first 35 characters are not used and 4 (:, f, ~, }) are reserved. This is why BIPLAN can work with a maximum of 88 functions, variables, parameters, strings and cycles.

Not to drastically limit the memory available BIP bytecode supports a memory read and write instruction that expects a numeric address, so depending on the machine you are running BIPLAN on, you may be able to address 2^32 or 2^64 bytes of memory.

Description Character Decimal
else ! 33
literal string separator " 34
for variable # 35
$ 36
modulus % 37
bitwise and & 38
' 39
open round parenthesis ( 40
closed round parenthesis ) 41
multiplication * 42
addition + 43
value separator , 44
subtraction - 45
. 46
division / 47
number 0 48
number 1 49
number 2 50
number 3 51
number 4 52
number 5 53
number 6 54
number 7 55
number 8 56
number 9 57
: : 58
next ; 59
less than < 60
= 61
greater than > 62
if ? 63
for @ 64
logic and A 65
break B 66
-- C 67
delay D 68
io E 69
end F 70
G 71
greater or equal H 72
less than or equal I 73
adc J 74
bit shift right K 75
bit shift left L 76
millis M 77
bitwise not N 78
logic or O 79
P 80
== equals to Q 81
random R 82
:[] S 83
not equal T 84
mem U 85
@[] V 86
W 87
X 88
Y 89
Z 90
[ [ 91
backslash \ 92
] ] 93
^ ^ 94
_ 97
++ ` 96
index a 97
char b 98
continue c 99
d 100
input e 101
function f 102
serial g 103
string h 104
i 105
jump j 106
system k 107
label l 108
size m 109
n 110
file o 111
print p 112
number q 113
return r 114
s 115
t 116
u 117
v 118
while w 119
end x 120
cursor y 121
restart z 122
function parameter { 123
bitwise or | 124
@ } 125
function call ~ 126
DEL 127