I am experimenting with ragel to validate and tokenize an algebraic expression in one step. Basically convert something like "3 + A * 2 / ( 1 - 5 )" to "[3.0, 'A' , 2.0, :*, 1.0, 5.0, :-, :/, :+]" if it's valid, and throw an error otherwise. I'm using the ruby target, and the standard "shunting yard" algorithm or whatever.
I have the thing working (I think, still testing) by using the scanner construct and making an "allowed transition" table by hand. Each of the tokenizing actions validates against this table to see whether it should continue. It seems to me that there is probably a nice way to do this within ragel itself but I can't seem to figure it out. Can somebody point me in the right direction? the files are up on github: http://github.com/prakatmac/expression-parser/tree/master Sorry if this is a dumb question. I'm pretty new at this stuff. Thanks. ~pramukta _______________________________________________ ragel-users mailing list [email protected] http://www.complang.org/mailman/listinfo/ragel-users
