Skip to content

A small library to help with mathematical expression parsing.

Notifications You must be signed in to change notification settings

fakedrake/ReadExp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read Exp(ression)

ReadExp is a small library to help with the parsing of mathematical expressions. Currently it only skips spaces, reads numbers and any other symbol it encounters, categorizes as operator. Single precision floating point and arbitrary bases with the syntax `bb#nn[.ff]` is suported. Note that this only uses string.h so it can work on embeded systems with little to no effort. Also the library is designed to be fed the characters one by one and return results in real time.

Usage notes

Use `getOp(char)` to feed the library characters of the expression one by one and returns a `struct symbol`:

struct symbol {
 unsigned type;
 char cval;
 int ival;
 float fval;
};

and for `type` the flags `NUMBER`, `FLOAT`, `OPERATOR` and `INVALID` are defined. Depending on the value of type the corresponding member is valid. getOp returns one by one the symbols it finds. `burstOp` has the exact same syntax only it may return a symbol that contains both a number and an operator.

Building

Just run `cmake .` and `make` and then you have full access to the library via the header and the .a file.

About

A small library to help with mathematical expression parsing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages