Monday, January 09, 2006

posted by skynare at 10:06 PM

"LIPL : Little Idiotic Programming Language" has


<expr> ::= <state> <operator> <state> { <operator> <state> }
<state> ::= '(' <name> ')'
<name> ::= <character> { <character> }
<character> ::= ANY CHARACTER. UNICODE WHATEVER
<operator> ::= =[<weight>]=> | <=[<weight>]=
<weight> ::= '(' (<func-call> | <name>) ')'


=========================
Example of <expr>
(f( => A)<=())=>(B)=>(B)<=(()() ())=>(C)

Meaning:
"f( => A" => ")"
")" => "B"
"B" => "B"
"()() ()" => "B"
"()() ()" => "C"

Step by step parsing (Always from left to right):
(f( => A)<=())
open paren detected. find closing paren.
closing paren detected. see if there is an operator.
operator detected. previous token is <state> : f( => A.

0 Comments:

Post a Comment

« Home