Friday, September 21, 2007

Herbert Robot : 'h' Language

In this article we will discuss the 'h' language the metod that will make you contact with Herbert - Our hero! ;)

h Language has many advantages that will make you contril Herbert
it is simple and powerful
it contain Statements ,Procedures, Arguments and Recursion

Let's Go forward:
1- the Statements:
statement is either command, procedure cal or procedural parameter,
2- Commands:
Herbert can go forward, turn left or turn right just order him
l : turn Left.
r : turn Right
s : go Straight
3- Procedure Defination
x[(P1,P2,P3,...Pk)]:c1c2c3...cy
x is the Procedure name.
Pk a parameter 0<= k <= 15 cy procedure command y > 0

4- Parameters:
parameters ( procedure arguments ) should be Capital letters.
5-Expression:
[-]X[[+/-X[+/-X..]]]
each X is either parametre or number
6- Arguments
a procedure argument can be number , Expression or statement.
7- Procedure Call:
x[(a1,a2,a3,...)]
x is the procedure name and ai is an argument
Note: no Procedre call if any numeric argument is 0 or less.
8- Recursion:
a call stack is available for recursion
f(A):sf(A-1)

in the next article we will review some examples how to manage Herbert and may review some problems from the warmup match next 27-9
Salam!