FlowIR Syntax ------------- FlowIR's syntax is intended to be a simple, easily parsed but easily entered creation. As I improve the parser, the syntax may likewise become more convenient. It is loosely based upon C. The grammar is a set of procedures, which follow the following template: void procedure_name() { } and look just like in C; so the following would be valid: argument list: int x, int y variable declarations: int x, y; have a generic form which looks like so: [var =] '[' opcode arg1=val1 arg2=val2 ']'; In this case, the opcode is the string name of one of the opcodes, such as "loadv". The arg1 and arg2 are labels for its various inputs. The val1 and val2 are simple expressions that yield operands; if the parser gets more advanced arbitrary expressions will be allowed here. If the optional [var =] is included, then the result of the opcode is assigned to that variable. Here are some examples: x = [add left=y right=z]; x = [scanv vec=vecvar val=$FFFFFFFF]; There are also the following special forms: 1. Procedure calls: "queue" proc (arg[, arg]*); "tail" proc (arg[, arg]*); The way to write the queue or tail opcode. Example: queue display_count(output_handler, count) tail recurse(output_handler, new_count) 2. Common mathematical operations: var = left+right; var = left-right; var = left*right; var = left/right; 3. Casting assignment: var = "cast" other_var Casts as needed. Used to convert types. Other tokens: Numerical constants look like in C: 0 0xFF Identifiers look like in C: [a-z_A-Z][a-zA-Z_0-9]*