Code Monkey home page Code Monkey logo

mathexpressionparser's Introduction

MathExpressionParser

Calculation of Mathematical Expressions

If you are integrating your own application with this Library, pls follow the below steps :

  1. Your application must come with its own Parser.l and ParserExport.h separate files. Copy them from ParserLib/Parser.l and ParserLib/ParserExport.h into your application

  2. Change the below line in UserParserL.h file : from #include "ParserExport.h" to #include "path to applications's ParserExport.h"

  3. Assuming your application has its own header file which lists all tokens enums and IDs, overwrite the values of enums/IDs in application's hdr file with those menthoned in MexprEnums.h. For example, if application file is app_tokens.h as below :

     typedef enum app_tokens_ {
    
         APP_OR,
         APP_PLUS,
         APP_MINUS 
    
     } app_tokens_t;
    

    then #include MexprEnums.h into app_tokens.h, and reassign values :

     typedef enum app_tokens_ {
    
         APP_OR = MATH_OR,
         APP_PLUS = MATH_PLUS,
         APP_MINUS = MATH_MINUS
    
     } app_tokens_t;
    
  4. Token ID values from 5001 to 5050 is reserved by this library, do not use the same in your application. See MexprEnums.h. Also, IDs [10000 - 10002] is reserved by Parser. see ParserExport.h.

  5. You need to #include ParserMexpr.h into your application's Src file to use the functions provided by this library to work with MathExpression parsing. This is the User API for this library.

  6. You must compile an link below 3 source files from this library into your application binary :

gcc -g -c MExpr.c -o MExpr.o gcc -g -c ExpressionParser.c -o ExpressionParser.o gcc -g -c ParserMexpr.c -o ParserMexpr.o

  1. Revisit below #define values defined in Mexpr.h if you want to update them as per your aplication needs :

#define MEXPR_TREE_OPERAND_LEN_MAX 128 #define MAX_EXPR_LEN 512

mathexpressionparser's People

Contributors

sachinites avatar

Stargazers

Rajesh Pillai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.