Parser

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


Parser is an applet that can interpret and run simple scripts. After a script is run, the defined variables are shown within brackets in the bottom text area, together with any printed output. If Parser has encountered an error, it will also be reported there, but unfortunately the error report is not neither precise, nor easy to understand...

Language Summary

Parser understands a language similar to C and Pascal. 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 flag string
end of line: ;
boolean constants: true false
logical operators: and or not !
commments (can nest): { }
functions: name[param1,param2]
Flow control statements

if flag1 then
  ;
elseif flag2 then
  ;
else
  ;
endif;
Loop statements
repeat
  if flag3 then
    break;
  endif;
  if flag4 then
    continue;
  endif;
while flag5;
Functions
string print[...]
string substring[any, int, int]
int getLength[string]
int stringToInt[string]
int random[int, int]
Operator precedence (same as Java)
= int string flag while
or
and
== !=
<= >= < >
+ -
* / %
not !
) ]



By Björn Carlin, 2001