COST Design Specs
Commands
---------------------------------------------------------
declare varible[array] as type
Declares a variable
struct label
... Variables
end struct
A structure similar to a C structure
let variable = rhs
Assigns a variable and does calculations
function rettype foo(parameter)
return(type)
end function
A function.. rettype is the type it returns... Parameters are passed by value by default...
Ex...
function int foo(bar as long)
return bar * 2
end function
To pass by refrence us &.. Ex..
function int foo(&bar as long)
if ... elseif .. else .. end if
An if statement
.. ex
if(a > 3)
call foo(5)
elseif(a < 3)
call bar(3)
else
return(5)
end if
for(assignement; loop til; increment)
next
Like a C for
while(expression)
end while
A while statement like the C while statement
do
loop until(expression)
Like a BASIC loop until
switch(variable)
case(value)
end switch
break
Breaks a loop
continue
Skips one time thru a loop
cout << expression << endl
like a C++ cout. Outputs
cin >> value
Gets input
Display
End display
Outputs a block of quotes
# comment
A comment
join label
Joins party
attack label
Attacks
buy label, price
buys something
sell label, price
Sells something
module label
Name of the module
P-Code
struct – A structure
end struct – End of a structure
declare – Declares a variable
move – Moves a variable
add – Adds a variable
subtract – Subtracs a variable
multiply – Multiplies a variable
divided – Divides a variable
power by - ^
modulas - %
display – Displays a block
cout – Line output
input (equal to >>) - Input
output (equeal to <<) - Outputs a valu
join – Joins party
attack – Attacks party
sell – sels an iterm
buy – Buys an item
test – Subtracts 2 value <0 = less than; =0 = Equal to; > - Greater than
jump_less – Jumps if less than
jump_greator – Jump if greater than
jump equal – Jump if equal
jump – Unconditional jump
Software
cost – Compiler
clib – Library manager
libcost.so – The library