How to evaluate a DSL with PARSE in Rebol? -


as learnt dsl, realized parse dialect in rebol can great lexer , parser. there example the parse tutorial:

    expr:    [term ["+" | "-"] expr | term]     term:    [factor ["*" | "/"] term | factor]     factor:  [primary "**" factor | primary]     primary: [some digit | "(" expr ")"]     digit:   charset "0123456789"      probe parse "4/5+3**2-(5*6+1)" expr     ;will output true 

the code above verifies if expression conforms "grammar" defined above. question is:

  1. how compute or evaluate it?
  2. how denote prior of operators such "*" , "+"?

1, generate either string or better block e.g. collect, can evaluate do.
2, there old example dialect gabriele santilli on rebol.org operator precedence.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -