Codes for Practical experiments of System Programming And Compiler Construction (Semester VI - Computer Engineering - Mumbai University)
Experiment List:
- To create your own library using macros
- To design lexical analyzer for a language whose grammar is known
- To study and the implementation of lex and yacc tool (A)To implement LEX PROGRAMS using Dev-Cpp
- To design and implement a program for LL(1) parser
- To generate 3-address code as an intermediate code representation 6.(A)Implementation of Code Optimization Techniques (B)Implementation of Target code generation phase of the compiler
- Implementations of two pass Macro Processor
- Ensure you have Python 3.x installed on your machine. You can download it from Python's official website.
- Ensure you have Flex(fast lexical analyzer generator) installed on your machine at "C:\GnuWin32". You can download it from Flex download link.
- Ensure you have Bison(Yacc-compatible parser generator) installed on your machine at "C:\GnuWin32. You can download it from Bison download link.
- Ensure you have Dev C++ installed on your machine at "C:\Dev-Cpp". You can download it from DEV C++ Download link.
- Open Environment Variables and add "C:\GnuWin32\bin" and "C:\Dev-Cpp\MinGW64\bin" to path. (If the path is different, ensure you add the correct bin path)
- Clone the repository
git clone https://github.com/riddhigupta1110/SystemProgrammingAndCompilerConstruction-VI-MU-CSE.git
- Navigate to the project directory:
cd SystemProgrammingAndCompilerConstruction-VI-MU-CSE
You can run each Python program using any code editor or the command line:
Using Visual Studio Code:
- Open Visual Studio Code.
- Open the project folder (SystemProgrammingAndCompilerConstruction-VI-MU-CSE) in VS Code.
- Open the desired .py file.\n
- Run the program by pressing F5 or by clicking the "Run" button in the top-right corner of the editor.
- Save your Lex files with “.l” extensions in any specific directory
- Open Command prompt and switch to your working directory where you have stored your lex file (“.l“)
Use the following commands in the same order as mentioned:
flex file_name
gcc lex.yy.c
a.exe
You can run on Dev C++ by:
- Save the .c and .h file
- Compile the .c file
- Run the .c file
- Incase of issues in compiling and/or running, use the following command:
gcc filename.c -o filename