INTRODUCTION

1.1    PROBLEM DEFINITION
            The important aim of our project is to have strong knowledge on compiler design techniques and fundamentals of java programming language. The first task of building a compiler is to generate the appropriate context free grammar. Also the lexical analyzer must be developed in a suitable fashion. The grammar that we are generating has its basis over the java programming language. In fact our grammar is the trimmed version of java grammar. The java language has several advanced features like inheritance, abstraction, encapsulation etc. But this one semester academic project primarily focuses on the most essential and basic features of the language.

            The output of our compiler must be a class file. The name of the class file must match with the name of the (single) class within the file. The class file is in the bytecode format. This bytecoded class file must be able to run on any standard JVM. This project is implemented using java language. We have used an Integrated Development Environment called Sun ONE Studio for implementing this project. After the lexical analysis parser phase is developed. As our grammar is non left recursive unambiguous grammar, the implementation of parser is straightforward by applying the methodology of recursive parsing.

            After the parsing stage is completed an abstract syntax tree is developed and integrated with the parser. This abstract syntax tree avoids the punctuation marks of the context free grammar. As those grammatical rules are checked already in the   parser it becomes meaningless to use them in this phase. After the construction of the abstract syntax tree a symbol table has been developed. We use the Leblanc cook symbol table methodology to implement the symbol table. After the symbol table generation we perform the context checking. We restrict ourselves to a fixed set of constraints and perform the checking. Finally we generate the bytecode and create the class file. This file is able to run on any standard JVM. Thus in this way we have planned our compiler construction project.

1.2    JAVA PROGRAMMING LANGUAGE
            Java is a general-purpose, concurrent, class-based, object-oriented language. It is designed to be simple enough that many programmers can achieve fluency in the language. Java is related to C and C++ but is organized rather differently, with a number of aspects of C and C++ omitted and a few ideas from other languages included. Java is intended to be a production language, not a research language.

            Java is strongly typed. This specification clearly distinguishes between the compile-time errors that can and must be detected at compile time, and those that occur at run time. Compile time normally consists of translating Java programs into a machine-independent byte-code representation. Run-time activities include loading and linking of the classes needed to execute a program, optional machine code generation and dynamic optimization of the program, and actual program execution.

            Java is a relatively high-level language, in that details of the machine representation are not available through the language. It includes automatic storage management, typically using a garbage collector, to avoid the safety problems of explicit deallocation (as in C’s free or C++’s delete). High-performance garbage-collected implementations of Java can have bounded pauses to support systems programming and real-time applications. Java does not include any unsafe constructs, such as array accesses without index checking, since such unsafe constructs would cause a program to behave in an unspecified way.

            In this way Java is superior to most of its contemporary languages. The success of Java lies in security and portability issues in the Internet and internet or LAN. This is due to the byte code generation of the Java compiler. Due to all these advantages of Java and as Java is the language of the WWW we have chosen the Java language grammar (trimmed version) as out target grammar and the Java language as our implementation language. Also to support portability issues we generate the byte coded class file bases on the Java Virtual Machine Specification.

<< Previous Next >>

Hosted by www.Geocities.ws

1