datastruct.txt
pdirt/drv/compiler/docs/datastruct.txt · 3.0 KB
From the archive pDirt-1_tar.gz
Download the archive « Back to the archive contents
variable declarations
----------------------------------------
Var_decl => <type> <the_vars>;
the_vars => var_name <more_vars>
more_vars => var_name <more_vars> | (null)
type => number, string, boolean
(if it is a string, it also expects (number) after the var_name, like
string bob(15); will produce a string of 15 in length)
constant declaration
----------------------------------------
const_decl => const_name = (data, numerical or boolean);
For loop
(this will increment by 1 automatically, since
rarely do we do anything else)
----------------------------------------
For_loop => for X is <number> to <number> loop
<statements> | (null)
end for;
While loop
---------------------------------------
while_loop => while <boolean> loop
<statements> | (null)
end while;
Repeat Until
---------------------------------------
repeat_until => repeat
<statements> | (null)
until <boolean>;
if_then
---------------------------------------
if_then => if <boolean> then
<statements> | (null)
<if_else>
end if;
if_else => else
<statements> | (null)
block structure
---------------------------------------
block_struct => begin
<statements>
end;
Mathematical Operators
---------------------------------------
arith_exp => taken care of by C compiler, dont want to mess with this, very complex, but
I do allow any arithmetic operators and will convert embedded mudcode functions.
It will not, however, do any checking of arithmetic syntax. Just the embedded
functions.
Boolean Operators
---------------------------------------
Boolean => takes in the entire boolean string, changes 'and' and 'or' to && and ||
but leaves the rest alone, again very complex, and again does allow embedded
functions. Will not check boolean syntax, only embedded function syntax.
Assignments
-------------------------------------
assignment =>
<string_variable> := <string1> + <string2> + ... + <stringN>; (uses strcat to combine them all
and will allow mudcode functions
in place of a string)
|
<integer_variable> = <arith_exp>;
Raw Code
--------------------------------------
raw => @
<raw code>
@
(raw code is any C code, it will grab raw all code between matching ampersands)
Statements
--------------------------------------
statements => <declarations>
<the_statements>
declarations => <var_decl> | <const_decl>
<declarations> | (null)
the_statements => <for_loop> |
<while_loop> |
<repeat_until> |
<block_struct> |
<assignment> |
<if_then> |
<raw>
<the_statements | (null)