Do you have an online demo, where I can write an expression in a text box and get the result?
What are the security implications of this? Does the code run in the server or my computer? Does it only recognize math functions, or it can also run "alert"?
hyoka uses a full recursive descent parser to parse expressions into AST, then evaluates to get the final result. it is very secure for math expressions unlike the eval function which can run javascript code.
you can try out a demo here
https://codesandbox.io/s/naughty-chatterjee-kr3bsc
I was trying to change the expression, but I need to change it twice. At the top where `expression` is defined and at the bottom to show it in the html. Is it possible to "see" what is inside an Expression object?
Damn that's pretty sweet, I've had to pretty much just make anything that needs extreme decimal precision work out on server side. Cool to know someone came up with a way to do it on frontend too, thanks!
According to this[1] okwave thread (in Japanese) it is used in mathematics literature but generally as a direct translation from English. There is an argument there, saying that the nuance of Hyouka in Japanese mathematics is more appropriate in cases where a specific value is harder to determine and as such is used more often for things like "inequality evaluation".