Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Looking to streamline your programming language analysis? Look no further than this collection of code snippets related to compiler design! From counting comments and lines in a file to eliminating left recursion and building parsing tables, these scripts and functions are sure to make your life easier.

Notifications You must be signed in to change notification settings

Palak807/Compiler-Design-Lab-Codes

Repository files navigation

Compiler Design Lab Codes

Welcome to the collection of code snippets related to compiler design! Here, you'll find a range of helpful scripts and functions to streamline the process of parsing and analyzing programming languages. Whether you're a seasoned programmer or just starting out, this repo is sure to make your life easier!

Code counting GIF

making_life_easy.py

Code to count the number of comments and lines in a file

This code can be used to count the number of comments and lines in a given file. It is useful for analyzing code metrics.

Code to detect and categorize keywords, operators, delimiters, identifiers, and numbers in a given text

This code can be used to detect and categorize different elements of a programming language, such as keywords, operators, delimiters, identifiers, and numbers. It is useful for building lexers.

Code to check for left recursion in a given grammar and, if present, to eliminate it using the left factoring method

This code can be used to check for left recursion in a given grammar and eliminate it using the left factoring method. Left recursion can cause infinite loops in a parser, so it is important to remove it.

Code to remove left recursion from a given context-free grammar and to calculate the first set of each non-terminal symbol

This code defines several functions to remove left recursion from a given context-free grammar and to calculate the first set of each non-terminal symbol. The first set is used to build a parsing table.

Code to find first set

This code can be used to find the first set of each non-terminal symbol in a given context-free grammar. The first set is used to build a parsing table.

Code to find follow set

This code can be used to find the follow set of each non-terminal symbol in a given context-free grammar. The follow set is used to build a parsing table.

Code to print the parsing table using first and follow

This code can be used to print the parsing table for a given context-free grammar using the first and follow sets of each non-terminal symbol. The parsing table is used by the LL(1) parser.

Python code that implements the LL(1) parser for a given grammar

This Python code implements the LL(1) parser for a given context-free grammar. The LL(1) parser uses a parsing table to parse a given input string.

Code to generate operator precedence table

This code can be used to generate an operator precedence table for a given set of operators. The operator precedence table is used by the parser to resolve operator ambiguities.

Code to generate operator function table

This code can be used to generate an operator function table for a given set of operators. The operator function table maps each operator to its corresponding function.

Implementation of SLR parser

This code implements the SLR parser for a given context-free grammar. The SLR parser uses a state machine to parse a given input string.

About

Looking to streamline your programming language analysis? Look no further than this collection of code snippets related to compiler design! From counting comments and lines in a file to eliminating left recursion and building parsing tables, these scripts and functions are sure to make your life easier.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages