# Compiler Design and Construction

**Lab 1:**

1. [Write a program to check whether the input is digit or not](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/1_a_digit_or_not.l)
2. [Write a program to identify tokens](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/1_b_identify_tokens.l)

**Lab 2:**

* Write a program in C to implement DFA that accepts string:
  * [baab](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/2_a_baab.c)
  * [abba](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/2_b_abba.c)

**Lab 3:**

1. [Write a program to check valid identifier](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/3_a_valid_identifier.c)
2. [Write a program to check valid comment or not](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/3_b_valid_comment.c)

**Lab 4:**

* [Write a program to count number of operators used in given input](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/4_count_operators.c)

  `Input: a=b+c*d`

**Lab 5:**

1. [Write a program to find the first of given grammar](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/5_a_first_of_grammar.c)

   ```c
   S->L+R
   S->R
   L->*R
   L->a
   R->L
   ```
2. [Write a program to find the follow of the given grammar](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/5_b_follow_of_grammar.c)

   ```c
   R->aS
   R->(R)S
   S->+RS
   S->aRS
   s->as
   ```

**Lab 6:**

* [Write a program for constructing of LL(1) Parsing](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/6_ll1_parsing.c)

**Lab 7:**

* [Write a program to implement Shift Reduce Parsing](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/7_shift_reduce_parsing.c)

  ```c
  E->E+E
  E->E/E
  E->E*E
  E->a/b
  ```

  `Input symbol: a+b+a`

**Lab 8:**

* [Write a program to implement intermediate code generation](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/8_intermediate_code_generation.c)

  `X=a+b-c*d/e`

**Lab 9:**

* [Write a program to implement machine code generation](https://github.com/sthsuyash/CSIT_Labs/blob/main/6th_Semester/Compiler_Design_and_Construction/9_machine_code_generation.c)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://suyashs-organization-3.gitbook.io/csitlabs/6th_semester/compiler_design_and_construction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
