Skip to content

Rakibul73/Compiler_Autometa_Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compiler and Autometa in Python 3
Python NumPy SciPy Matplotlib OpenCV Jupyter Notebook Visual Studio Code

Installations

  • Python 3 can be downloaded from here. Make sure to check Add Python 3.x to PATH during installation.
  • NumPy, SciPy, and matplotlib etc libraries can be downloaded and installed using the commands:
pip install numpy
pip install scipy
pip install matplotlib
pip install library-name

or if you have multiple python version installed use this

py -3.9 -m pip install numpy
py -3.11 -m pip install numpy
.....

Code for Academic Course CIT-412 (Compiler Design and Autometa Theory Sessional)

Masud Sir Lab ----------------------------


Lab 01: Write a program to identify whether a given line is a comment or not.

Jupyter File (Identify Python Comment)    /    Jupyter File (Identify C Comment with Regex)    /    Jupyter File (Identify C Comment without Regex)


Lab 02: Write a program to recognize strings under 'a', 'a*b+', 'abb'.

Jupyter File

Lab 03: Write a program to test whether a given identifier is valid or not.

Jupyter File (With Regex)    /    Jupyter File (Without Regex)

Lab 04: Write a program to recognize of tokens from lexemes.

Jupyter File (With Regex)    /    Jupyter File (Without Regex)

Lab 05: Write a program to recognize blank, white space, tab, and newline.

Jupyter File

Lab 06: Write a program to simulate lexical analyzer for validating operators.

Jupyter File (With Regex)

Extra Lab: Write a program to simulate lexical analyzer & make tokens.

Jupyter File (With Regex)

Lab 07: Write a program for constructing of LL (1) parsing.

Jupyter File    /    Jupyter File (Alternative)

Lab 09: Write a program for constructing recursive descent parsing.

Jupyter File (With Regex)

Extra Lab: Write a program for lexical analyzer + recursive descent parsing.

Jupyter File (With Regex)

Lab 10: Design a Predictive Parser for the following grammar

G: {E-> TE’, E’ -> +TE’ | 0, T-> FT’, T’-> *FT’|0, F-> (E) | id}.

Jupyter File (With Regex)

Lab 11: Write a program to calculate First and Follow sets of given grammar.

G: {E-> TE’, E’ -> +TE’ | 0, T-> FT’, T’-> *FT’|0, F-> (E) | id}.

Jupyter File    /    Jupyter File (Alternative)    /    CPP File

Lab 12: Write a program to implement top-down parsing for a given Grammar.

G: {E-> TE’, E’ -> +TE’ | 0, T-> FT’, T’-> *FT’|0, F-> (E) | id}.

Jupyter File

Lab 13: Write a Program to implement bottom-up parsing for a given Grammar.

G: {E-> TE’, E’ -> +TE’ | 0, T-> FT’, T’-> *FT’|0, F-> (E) | id}.

Jupyter File    /    CPP File

Lab 14: Write a Program to construct LR (0) parser for a given augmented Grammar.

Jupyter File

Lab 15: Write a program to construct SLR parser for a given augmented Grammar.

Jupyter File

Extra Lab: Write a program to detect lexemes from the input statement position = initial + rate * 60 Implement a program for detecting tokens from the input "int a = b + 10c + 7" and a token is either keyword, an identifier, a constant, a string literal, or a symbol

Jupyter File

Extra Lab: Write a program to convert infix into prefix , postfix & 3 address code

Jupyter File

Extra Lab: Write a program to generate the three-address code from a source-language expression:

a = (-c*b) + (-c*d).

Jupyter File    /    C File


Mahabub Sir Lab ----------------------------


Lab 01: NFA for any transition diagram.

Jupyter File


Lab 02: DFA for any transition.

Jupyter File    /    ALternative from NOYON

Lab 03: NFA to DFA converter.

Jupyter File