https://github.com/marcos-venicius/mca
It's a math expression compiler/evaluator to asm.
https://github.com/marcos-venicius/mca
asm c clang compiler gcc interpreter math
Last synced: over 1 year ago
JSON representation
It's a math expression compiler/evaluator to asm.
- Host: GitHub
- URL: https://github.com/marcos-venicius/mca
- Owner: marcos-venicius
- License: mit
- Created: 2025-02-01T13:44:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-11T19:16:18.000Z (over 1 year ago)
- Last Synced: 2025-02-11T20:26:24.667Z (over 1 year ago)
- Topics: asm, c, clang, compiler, gcc, interpreter, math
- Language: C
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCA

It's a math expression evaluator/compiler to asm.
Basically, you can pass programming language math as a string, and get back a file in asm that do this math or just evaluate (which is very useful).
The name:
- **M** math
- **C** compiler
- **A** asm

## Available operators
- `*` times
- `-` subtract
- `+` sum
- `/` divide
- `%` modules
- `^` power
all the numbers will be handled as C Doubles.
## Examples
```
10 + 10
```
```
2 + 2 / 2
```
```
(2 + 2) / 2
```
```
2 * 2 / (2 + (2 - 3))
```
```
5.5 * 2 / 3
```
## We have some bugs yet
I'm not properly parsing the tokens before mount the ast, so expressions like `2 * 2 - 2 2 2` will kinda work, but with the wrong result.
Or for example `2 (^ 2 + 2)`, will return a wrong result without any errors.
## Debugging
you can export `MCA_LOG_ENABLED` as `1` to enable logging.
```bash
export MCA_LOG_ENABLED=1
```