Develop a Compiler Design model to construct and exercise all compiler properties and demonstrate all the compiler stages needed to be performed during execution of code.
The compiler is software that converts a program written in a high-level language (Source Language) to a low-level language (Object/Target/Machine Language/0, 1โs).A translator or language processor is a program that translates an input program written in a programming language into an equivalent program in another language. The compiler is a type of translator, which takes a program written in a high-level programming language as input and translates it into an equivalent program in low-level languages such as machine language or assembly language.
The programs are written in lex and yacc program.Lex helps you by taking a set of description of possible tokens and producing a Croutine, which we call as lexical analyzer or a lexer, that identify the tokens. As input isdivided into tokens, a program often needs to establish the relationship among thetokens. A compiler needs to find the expression, statement, declaration, blocks andprocedure in the program. This task is known as parsing and the list of rules thatdefine the relationship that the program is a grammar. Yacc takes a concisedescription of a grammar and produces a C routine that can parse the grammar, aparser. The yacc parser automatically detects whenever a sequence of input tokenmatches one of the rule of the grammar and also detects a syntax error whenever itsinput does not match any of the rule. When a task involves dividing the input intounits and establishing some relationship among those units then we should use lexand yacc.