https://github.com/raymondjavaxx/yuka
simple and lightweight expression evaluator
https://github.com/raymondjavaxx/yuka
bytecode expression-evaluator expression-parser
Last synced: about 1 year ago
JSON representation
simple and lightweight expression evaluator
- Host: GitHub
- URL: https://github.com/raymondjavaxx/yuka
- Owner: raymondjavaxx
- Created: 2011-09-30T03:22:44.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2013-12-26T05:44:22.000Z (over 12 years ago)
- Last Synced: 2025-03-20T04:57:37.229Z (over 1 year ago)
- Topics: bytecode, expression-evaluator, expression-parser
- Language: C++
- Homepage:
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Yuka
====
Yuka is a lightweight expression evaluator writen in C++.
How To Use It
-------------
Just create an instance of `yuka::Compiler` and use it for compiling your expression into Yuka bytecode. The bytecode can later be fed to an instance of `yuka::VM` for evaluation.
#include "yuka/yuka.h"
...
char expression[] = "(5^2)+3*5";
yuka::Compiler *compiler = new yuka::Compiler();
yuka::ByteCode *bc = compiler->compile(expression, strlen(expression));
yuka::VM *vm = new yuka::VM;
yuka::Value result = vm->run(bc);
cout << result.int_value << endl; // 40
TODO:
-----
* Add support for constants (and variables?)
* Function support