1 / 11

Compiler Design

Compiler Design. PROJECT PRESENTATION : COMPILER FOR OBJECTIVE C Group 10. Objective C: An Introduction. The Objective-C language is a strict superset of the standard C language, designed to give C full object-oriented programming capabilities.

jaden
Download Presentation

Compiler Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Compiler Design PROJECT PRESENTATION : COMPILER FOR OBJECTIVE C Group 10

  2. Objective C: An Introduction The Objective-C language is a strict superset of the standard C language, designed to give C full object-oriented programming capabilities. The Objective-C model of object-oriented programming is based on sending messages to sovereign objects. An object with method "method" is said to "respond" to the message method. [objmethod:parameter]; Objective-C messages do not need to execute because they are dynamically bound.

  3. Non-C features : • Interfaces and implementations Objective-C requires the interface and implementation of a class be in separately declared code blocks. The interface is put in a header file The actual code is written in @implementation block. • Instantiation This is done by first allocating the memory for a new object and then by initializing it. MyObject * o = [[MyObjectalloc] init] • Protocols An informal protocol is a list of methods which a class can implement.

  4. Dynamic typing An interesting feature of the language is that an object can be sent a message that is not specified in its interface. • Forwarding If message is sent to an object which might not respond to it, it forwards the message on to an object which can respond to it. • Posing Objective-C permits a class to pose for another class within a program, i.e., all messages of the target class are received by the posing class. • Category Categories permit the programmer to add methods to a class and replace an existing method.

  5. History & Evolution • Hybrid between Smalltalk and C. • Created primarily by Brad Cox and Tom Love who began by modifying the C compiler to add some of the capabilities of Smalltalk. • The GNU Objective-C runtime which has been in use since 1993 is the one developed by Kresten Krab Thorup. • Most of Apple's present-day Cocoa API is based on OpenStep interface objects, and is the most significant Objective-C environment being used for active development.

  6. Why better than others? • Objective-C messages do not need to execute because they are dynamically bound. If message is not implemented the code will still compile and run, unlike statically typed languages like C++. • Delegating methods to other objects and remote invocation can be easily implemented using categories and message forwarding. • Instead of using an Enumerator object to iterate through a collection, Objective-C offers the fast enumeration syntax. • Since ObjC is C plus Objects, it's very compatible with C code bases.

  7. Categories allow addition of methods to classes after the class's initial definition. We can redefine an existing method's implementation. • Objective-C has a dynamic run-time. It allows crafting messages at run-time, dynamically creating classes, dynamically adding methods to existing classes, changing method implementations and so on. • ObjC has real, fast, runtime message sending. • #import appends a file only if it has not been already appended, unlike #include.

  8. Progress till now • Lexical Analysis : Completed Tool used : Lex • Syntax Analysis : Almost Completed Tool used : Yacc • Symbol Table : Hash table of an object with attributes -lexeme and token. The hash function we chose is: length(lexeme)%5 All the identifiers go in the SymbolTable and an identifier is inserted only if it is not already present in it. • We initially decided that C++ as our implementation language but now have to convert our Symbol Table implementation to C.

  9. End User commands • Objective-C code is to written in a .m file. • The compiler can be invoked by the following commands: $dawk –h? –d? –p? (-o <target>) <src.m>

  10. Future Plans • We have almost completed parser and testing would be complete before the deadline on 28th. • We have not yet skipped any language feature and we are aiming to keep it that way till the end. • We are not so keen on the optimization. • And we have a strong belief that sticking to future deadlines would ensure successful completion of our project.

  11. Thank You Harshal A. Waghmare Jeet Kumar Nandan Dubey Vishal Agrawal

More Related