Javascript parser for simple expression

后端 未结 6 2239
再見小時候
再見小時候 2020-12-05 03:57

I would like to find a javascript parser that can handle and evaluate simple expressions. The parser should be able to evaluate the regular mathematical expressions, and sup

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 04:05

    haven't used it, but a quick google reveals http://jsfromhell.com/classes/math-parser

    edit:

    What you want to do may be out of reach of the first link, you could also have a look at Douglas Crockford's "parser for Simplified JavaScript"

    It's just a parser, so you would have to do all the evaluation yourself. It would, however, make it somewhat easier and it doesn't use eval.

提交回复
热议问题