////////////////////////////////////////////////////////////////////////////////////// ---------------------- Expression Evaluator -------------------- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Hi, this is a little expression evaluator, that means that you can enter an expression and get the correct output (ex: 3+3 * 2 = 9 and (3+3) * 2 = 12). This system respect the operation order. Press [space] to enter a new expression Operation allowed : '+', '-', '*', '/', '%' and '^' Functions allowed : cos, sin, tan, acos, asin, atan, exp, ln, log, sqrt, round, floor, ceil and length Variables allowed : x and y This system is not using the postfixe method but generate an abstract syntax tree and uses it to get the valid result
I already made a system like that on python and switch it into Scratch when I was bored... So everything by me... if you want feel free to use it... just credit please ! - v0.1: made a lexer, parser and interpreter; - v0.1.1 : fixed the power bug; - v0.2 : added the functions; - v0.2.1 : fixed the interpreter bug; - v0.2.2 : added variables; - v0.2.3 : fixed the errors; - v0.2.4 : fixed the memory load bug; - v0.2.5 : added the evaluate without refreshing; - v0.2.6 : added the mod(%) operator; [well... don't mind this] #expression #math #variable #function #interpreter