Skip to content

X-Parser is a lightweight C++ expression evaluator that supports basic operations, variables, constants, and many built-in functions. It’s fast, easy to use, and allows users to add custom functions. The parser caches expressions for better performance and has no external dependencies.

License

Notifications You must be signed in to change notification settings

JonayedMohiuddin/X-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 

Repository files navigation

X-Parser (Advanced Expression Evaluator)

       ____     _____
      /\   \   //   /
      \ \   \ //   /         ______
       \ \   \/   /    ___  | |  _ \ __ _ _ __ ___  ___ _ __
        \ \       \   |___| | | |_) / _` | '__/ __|/ _ \ '__|
        / /   /\   \  |___| | |  __/ (_| | | \\__ \  __/ |
       / /   /\ \   \       |_|_|  \\__,_|_| ||___/\___|_|
      / /   /  \ \   \
      \/___/    \_\___\                           BY JONAYED

Features

  • Lightweight and fast expression parser
  • New functions can easily be added
  • Compiled expressions are cached for performance and later use
  • Result types of STRING, NUMBER
  • Constants
  • Variables

Requirements

This project uses C++ 21 and requires no additional libraries other than the ones provided by the GCC or Clang.

Installation

From source

Clone the repository from Github:

  • $ git clone https://github.com/JonayedMohiuddin/X-Parser
  • or, Download the zip and unzip on your workspace folder.

Compile the project and run the object file:

Using Gcc

  • Compiling : g++ main.cpp -o main
  • Running : ./main

Using Clang

  • Compiling : clang++ main.cpp -o main
  • Running : ./main

Data types

NUMBER - All numbers are handled as Double

Misc

EMPTY 

Basic operations supplied by X-Parser

Evaluation  
Assignment  =
Operators   + - * / MOD % ^ POW
Logical     < <= == != >= > AND OR NOT
Ternary     ? :  
Binary      << >> | &
Constants   NULL PI
Functions   CLEARMEMORY CLEARVARIABLES

Optional functions supplied

Functions   ABS ARCCOS ARCSIN ARCTAN ARRAYLEN AVERAGE CEILING CONTAINS CONTAINSALL CONTAINSANY
            COS DIGITSONLY ENDSWITH EXP FACTORIAL FIND FLOOR FORMAT FORMATBYLEN GUID HEX ISANYOF ISBLANK ISBOOLEAN ISDATE
            ISNONEOF ISNULL ISNUMBER LEFT LEFTOF LEN LOG LOG10 LOWER MAKEBOOLEAN MAKEDATE MATCH 
            MAX MID MIN NAMECASE RANDOM  REPLACE REPLACEALL REPLACEFIRST RIGHT RIGHTOF ROUND SIN 
            SPLIT SQR SQRT STARTSWITH STR STRING TAN TRIM TRIMLEFT TRIMRIGHT UPPER VAL

Usage

Examples:

Current Version

V.1.1.5 - Last Breath

Version History

2.0.0 Future Update (Resurgence)

  • Deprecation of old algorithm
  • Implementation of new Algorithm
  • Lexer and Tokens restructured

1.1.0 Feature Upgrade (Last Breath)

  • Improved Lexer
  • Multiplication is default operator.
  • Added brace/parantheses support

1.0.5 Feature Upgrade

  • Added basic functions
  • More operators

1.0.0 Initial release to GitHub.

License

X-Parser is licensed under the MIT Licence license. Permission is granted to anyone to use this software for any purpose, including commercial applications.

About

X-Parser is a lightweight C++ expression evaluator that supports basic operations, variables, constants, and many built-in functions. It’s fast, easy to use, and allows users to add custom functions. The parser caches expressions for better performance and has no external dependencies.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages