Implementation of Syntax Analyzer to Validate syntax & Type of Variable using YACC Tool
Channel: Department of Computer Engineering
Date: 2022-03-23

Link for program:---https://drive.google.com/file/d/1NMhsVm7oiefGELJkCfwRw0e8C4tyG8bi/view?usp=drivesdk

Write a program using YACC specifications to implement syntax analysis phase of compiler to validate type and syntax of variable declaration in c/c++/Java.
compiler design,
compiler construction,
compiler design ipu,
compiler and interpreter,
compiler design lecture,
compiler construction tools,
compiler design tutorial,
compiler design in hindi,
compiler design gate,
compiler assembler interpreter,
compiler and translator,
compiler architecture
hOW TO RUN LEX AND YACC PROGRAM.
COMPILER CONSTRUCTION PROGRAM
 Parser:

A parser is a program that checks whether its input (viewed as a stream of tokens) meets a given grammar specification. The syntax of SIL can be specified using a Context Free Grammar. As mentioned earlier, YACC takes this specification and generates a parser for SIL.

Context Free Grammar (CFG):

A context free grammar is defined by a four tuple (N,T,P,S) - a set N of non-terminals, a set T of terminals (in our project, these are the tokens returned by the lexical analyzer and hence we refer to them as tokens frequently), set P of productions and a start variable S. Each production consists of a non-terminal on the left side (head part) and a sequence of tokens and non-terminals (of zero or more length) on the right side (body part). We will explore productions further in detail later in this documentation. For more about context free grammars refer to this wiki . 
A parser generator is a program that takes as input a specification of a syntax, and produces as output a procedure for recognizing that language. Historically, they are also called compiler-compilers.

YACC (yet another compiler-compiler) is an LALR(1) (LookAhead, Left-to-right, Rightmost derivation producer with 1 lookahead token) parser generator. YACC was originally designed for being complemented by Lex.

    YACC stands for Yet Another Compiler Compiler.
    YACC provides a tool to produce a parser for a given grammar.
    YACC is a program designed to compile a LALR (1) grammar.
    It is used to produce the source code of the syntactic analyzer of the language produced by LALR (1) grammar.
    The input of YACC is the rule or grammar and the output is a C program.