Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jean-baptiste-dp/compiler-yacc-lex
Yacc and Lex compiler - with variables, if conditions, for & while loop and functions
https://github.com/jean-baptiste-dp/compiler-yacc-lex
c compiler functions if-else lex loops yacc yacc-lex
Last synced: 7 days ago
JSON representation
Yacc and Lex compiler - with variables, if conditions, for & while loop and functions
- Host: GitHub
- URL: https://github.com/jean-baptiste-dp/compiler-yacc-lex
- Owner: Jean-Baptiste-DP
- Created: 2023-02-04T16:17:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T14:30:05.000Z (almost 1 year ago)
- Last Synced: 2024-02-15T15:41:05.553Z (12 months ago)
- Topics: c, compiler, functions, if-else, lex, loops, yacc, yacc-lex
- Language: C
- Homepage:
- Size: 167 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Language compiler with Lex and Yacc
## Running the project
```bash
bison -d yaccLex/compiler.y
flex yaccLex/compiler.l
gcc -o compiler compiler.tab.c lex.yy.c src/*.c src/*/*.c
./compiler examples/exFunction.txt
```Once the *compiler* file is compile, you can only run the last line to execute your program.
It's also possible to run the program line by line (like while executing "python3") with :
```bash
./compiler
```## Feature
Currently, the program is only supporting types **int**, **boolean** and **float**.
The program is able to do :
- **variable**
- **if / if else condition** (run *examples/exIfCondition.txt* to see example)
- **for** and **while loop** (run *examples/exForWhile.txt* to see example)
- **function** that can be **recursive** (run *examples/exFunction.txt* to see example)