An open API service indexing awesome lists of open source software.

https://github.com/yjdoc2/equation-parser-interpreter

An interpreter designed in C++ for the equation parser project.This can read the commands from a file and write output to another file.
https://github.com/yjdoc2/equation-parser-interpreter

c cpp17 interpreter parser

Last synced: 23 days ago
JSON representation

An interpreter designed in C++ for the equation parser project.This can read the commands from a file and write output to another file.

Awesome Lists containing this project

README

          

# Equation-Parser-Interpreter

This is an file based interpriter for Equation Parser.

## Basic Usage

#### Compiling

generate the runfile using makefile and make command (on linux), requires gcc and g++, with c++ std 14 support.

For manual compiling :


  1. gcc -c cparser.c -lm ; which will give cparser.o

  2. g++ -c main.cpp; which will give main.o

  3. g++ -o eqparse cparser.o main.o; which will give eqparse

#### running

eqparse <script_file> [output_file] (Without Brackets)

script file is any valid text file written with valid syntax.
output file is optional.
If not given output will be given on standerd output - either console or redirected file if output redirection is done.
If given output will Overwrite the file.

## Syntax :


  • All Non-comment Lines should be less than 150 characters long in total.

  • Lines starting with ' // ' and empty lines will be ignored.

  • Contents of line starting with ' # ' will be copied as it is (except #) in the output.

  • All inbuilt commands, equations and variable assignments must be given on a line by themselves,i.e. Comments cannot start mid-way in a line.

  • Allowed inbuild commands Are : showvars , vardump , varload , varclear.

  • to solve an equation, or for variable assignment, give the expression on the line by itself.

  • Assignment of variable can be done as :

    1. $0 to $9 = expr ---for inbuilt variables

    2. varname = expr ---for custom named variables.



  • To find roots of a polynomial equation , use polysolve <space> expr

  • To solve system of linear equation with less than 9 variables:

    • First give linsolve <space> <number of variables (n)>

    • Then give the linear equations using variables x0 to x(n-1) on next consecutive lines.



Also look at syntax of Equation Parser Mk II for general syntax.