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

https://github.com/josethz00/math_interpreter

Repo destinated to studies about languages, compilers, interpreters, grammars and lexical and sintax analysis
https://github.com/josethz00/math_interpreter

c lex yacc

Last synced: 9 days ago
JSON representation

Repo destinated to studies about languages, compilers, interpreters, grammars and lexical and sintax analysis

Awesome Lists containing this project

README

          

Basic Math Interpreter
=============

This is a simple math expression interpreter written with C, Lex and Yacc

1. Use ``` make ``` command in your terminal to compile ```.y```, ```.l``` and ```.c``` files and then run

### Limitations:
- For now, the language only supports variables with integer variables, not floats neither strings
- The supported operators are: ```=``` (assignment), ```-``` (subtraction), ```+``` (sum), ```*``` (multiplication), ```/``` (division), ```sqrtof``` (square root of) and ```powerof``` (power of)
- Operators precedence is not supported yet
### Language grammar examples:
```
a = 10;
print a;
```

```
a = 10 + 191;
print a;
```

```
a = 90;
print a;
a = a + 22;
print a;
```

```
a = 10;
b = 30;
c = a + b;
print c;
```