Thanks, really useful! On Wed, Nov 1, 2017 at 2:18 AM, Hamish Ogilvy <hamish.ogi...@gmail.com> wrote: > Hey Jose, > > Yep, might be worth a look at: https://github.com/influxdata/influxql for a > pretty advanced and open source version. Also look at Rob Pike's calculator > talk: https://www.youtube.com/watch?v=PXoG0WX0r_E That helped me a lot. You > basically need a tokeniser and you then scan the input into tokens and build > a tree of functions to represent the input. > > It's really valuable to build your own from scratch if you can. > > Best. > > On Wednesday, 1 November 2017 03:50:10 UTC+11, jose wrote: >> >> Hi Hamish, >> >> Any updates on how to tackle this problem with current Go tools ? >> >> Is it useful to use some of the Go parse tools or AST ? >> >> Thanks >> >> On Sat, Feb 22, 2014 at 11:01 AM, Hamish Ogilvy <hamish...@gmail.com> >> wrote: >> > Cool javascript, nice way to visualise! RPN was a useful tip, found one >> > interesting one Go based: >> > https://github.com/zephyrtronium/rpn >> > >> > Looks like i'll have to smash this out myself. Will post it once done. >> > >> > Thanks again! >> > >> > >> > On 22 February 2014 20:11, egon <egon...@gmail.com> wrote: >> >> >> >> Essentially what you need to do is first tokenize the text and then >> >> transform that to a hierarchy of expressions. >> >> >> >> 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 >> >> >> >> -- >> >> 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. >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "golang-nuts" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to golang-nuts...@googlegroups.com. >> > For more options, visit https://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.