Abstract
Compiler is a program whose functionality is to translate a computer program written in source language into an equivalent machine code. Compiler construction is an advanced research area because of its size and complexity. The source codes are in higher level languages which are usually complex and, consequently, increase the level of abstraction. Due to such reasons, design and construction of error free compiler is a challenge of the twenty first century. Verification of a source program does not guarantee about correctness of code generated because the bugs in compiler may lead to an incorrect target program. Therefore, verification of compiler is more important than verifying the source programs. Lexical analyzer is a main phase of compiler used for scanning input and grouping into sequence of tokens. In this paper, formal construction of deterministic finite automata (DFA) based on regular expression is presented as a part of lexical analyzer. At first, syntax tree is described based on the augmented regular expression. Then formal description of important operators, checking nullability and computing first and last positions of internal nodes of the tree is described. In next, the transition diagram is described from the follow positions and converted into deterministic finite automata by defining a relationship among syntax tree, transition diagram and DFA. Formal specification of the procedure is described using Z notation and model analysis is provided using Z/Eves toolset.
Highlights
A compiler is itself a computer program which translates computer program written in source language into an equivalent machine code
Formal construction of deterministic finite automata (DFA) based on regular expression is presented as a part of lexical analyzer
The transition diagram is described from the follow positions and converted into deterministic finite automata by defining a relationship among syntax tree, transition diagram and DFA
Summary
A compiler is itself a computer program which translates computer program written in source language into an equivalent machine code. There exists much work on compiler construction and verification but it needs further investigation This is because the bugs in the compiler can lead to an incorrect machine code even the source program is completely verified to be correct. The preliminary results of this research describing formal construction of syntax tree from regular expression were described in [3]. Formal description of three important operators checking null-ability and computing first and last positions of all the internal nodes of the syntax tree are described. Integration of approaches has become a wellresearched area in computer science [4,5,6] but there does not exist much research work on construction and verification of compiler by linking formal techniques and automata theory.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have