Compiler

You need a Java-enabled web browser to view this applet.


Compiler is an applet that can interpret and run scripts.

Language Summary

Compiler understands a language similar to C and Java (though not object-oriented). It is probably most easily understood by reading the example code, but you can also read the language "specification" below.
Operators
arithmetic operators: + - * / % & | ^ ~
parentheses: ( )
comparison operators: < > <= >= == !=
assignment operator: =
variable decraration: int boolean string
end of line: ;
boolean constants: true false
logical operators: && || !
commments: // /* */
functions: name(param1, param2)
Flow control statements

if (bool1) {
  ;
} else if (bool2)
  ;
else
  ;
Loop statements
do {
  if (bool3)
    break;
  if (bool4)
    continue;
} while (bool5);

while (bool6) {
  ;
}

Compiler will happily crash when fed infinite recursion, and will freeze in infinite loops.
Functions
void print(string)
string substring(string, int, int)
int random()
Operator precedence (same as Java)

( )
! ~ + (unary) - (unary)
* / %
+ -
<= >= < >
== !=
&
^
|
&&
||
=



By Björn Carlin, 2002