- Bytecode
- Configuration
- Comments
// - Conditions
ifelseend - Constants
truefalseHIGHLOWINPUTOUTPUT - Cycles
forwhilenextbreakcontinue - Functions
functionlocalsreturndone - Macros
macro - Numeric variables
@@[] - Operators
+-*/%==!=>>=<<=&&||&|^>><<++--~not - Strings
::[] - System functions
adc readargscharcursordelayfile closefile openfile readfile writepipe closepipe openpipe readpipe writeincludeindexinputio openio readio writememmillisnumbernumericprintrandomrestartserial openserial readserial writesizestopstring - Unary operators
++--
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
stopThis 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 saved in a .bip file that can be browsed as any other text file. In BIP bytecode numbers, arithmetic operators and strings are still human readable, instead system functions, variables and other constructs are compiled in a shorter form. Here is a table of the substitutions required to compile the BIPLAN example above in BIP bytecode:
| BIPLAN | BIP |
|---|---|
print |
p |
@a |
}$ |
stop |
x |
After removing LF, CR, TAB and SPACE the final BIP bytecode is obtained.
The variable @a is compiled in }$, where } is the numeric variable identifier and $ is the address (36, or $ means address 0).
BIPLAN supports up to 87 functions, variables, parameters, strings and cycles. Using the ASCII encoding and representing addresses with one character restricts their number to 87 (the first 35 characters and :, f, ~, }, @, # are reserved).
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.
The following table contains the whole BIPLAN to BIP bytecode dictionary.
| Description | Character | Decimal |
|---|---|---|
else |
! |
33 |
literal string separator |
" |
34 |
for variable (followed by address) |
# |
35 |
$ |
36 | |
| modulus | % |
37 |
| bitwise and | & |
38 |
' |
39 | |
| open round parenthesis | ( |
40 |
| closed round parenthesis | ) |
41 |
| multiplication | * |
42 |
| addition | + |
43 |
| function parameter 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 |
: (followed by address) |
: |
58 |
next |
; |
59 |
| less than | < |
60 |
= |
61 | |
| greater than | > |
62 |
if |
? |
63 |
for (followed by address) |
@ |
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 (followed by address) |
f |
102 |
serial |
g |
103 |
string |
h |
104 |
i |
105 | |
j |
106 | |
pipe |
k |
107 |
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 |
{ |
123 | |
| bitwise or | | |
124 |
| numeric variable, function parameter (followed by address) | } |
125 |
| function call (followed by address) | ~ |
126 |
| DEL | 127 |