Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arya2004/compiler-design
https://github.com/arya2004/compiler-design
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/arya2004/compiler-design
- Owner: arya2004
- License: apache-2.0
- Created: 2024-07-25T07:28:44.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-29T07:30:57.000Z (3 months ago)
- Last Synced: 2024-08-29T08:57:03.605Z (3 months ago)
- Language: Lex
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Compiler Design Uni Lab Course Codes in Lex
This repository contains the laboratory course codes for the Compiler Design course using Lex. The codes are designed to illustrate various concepts in compiler design, including lexical analysis, token generation, pattern matching, and more.
## Prerequisites
Before running any Lex program, ensure you have the following installed:
- **Flex**: Fast Lexical Analyzer Generator
- **GCC**: GNU Compiler Collection (for compiling the generated C code)## Installation
1. **Install Flex**:
- On Ubuntu: `sudo apt-get install flex`
- On macOS: `brew install flex`2. **Install GCC**:
- On Ubuntu: `sudo apt-get install gcc`
- On macOS: `brew install gcc`## How to Use and Run Lex Programs
1. **Write or Edit the Lex file** (e.g., `lab1.l`) to define the patterns and actions.
2. **Generate the C file** from the Lex file using Flex:
```bash
flex lab1.l
```This will produce a file named `lex.yy.c`.
3. **Compile the generated C file** using GCC:
```bash
gcc lex.yy.c -o lab1
```This will produce an executable named `lab1`.
4. **Run the executable**:
```bash
./lab1 < input.txt
```Replace `input.txt` with the name of the file you want to process, or provide input directly if the program reads from standard input.
## Contributing
If you have any improvements or additional lab exercises to contribute, please fork this repository, make your changes, and submit a pull request.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For any queries or issues, please create an issue in this repository or contact the course instructor.