Simplest way is to apply shunting yard algorithm and do the expression evaluation with RPN. This works very well if you only have binary operators.
Alternatively you can use some sort of simple parser... one that I experimented was was http://egonelbre.com/js/bigram/, and should suit your needs well enough (although it is written in javascript, it's fairly short and simple... but inefficient in speed).
There's also possibility to use ragel with go to generate a state machine that builds the hierarchy.
If you are not going to do very complex language, then yacc might be overkill.
egon
egon
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/phpOipu03G0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.