Skip to content

raymondjavaxx/yuka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

simple and lightweight expression evaluator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages