Objective-C 2 Preprocessor (objc2pp) will add some new features to the language

Assumptions are based on
* http://www.quepublishing.com/articles/article.asp?p=665128&seqNum=3&rl=1
* http://developer.apple.com/leopard/overview/tools.html

ToDos:

- add __strong and __weak keywords/attributes for pointers and somehow pass to the GC
- add a global/local symbol table and track if identifiers are declared as types by typedef, @interface/@protocol/@implementation, or @class
- add real translator functions. Most of the code can be echoed 1:1
- add __attribute__
- handle using keywords in method selectors i.e. - (void) for:(NSString *) str; is an allowed method name
- fix syntax
- complete building and echoing of AST (pretty printed?)
- handle/pass through original line numbers so that source code debugging works with gdb


Ideas how translation of the new keywords could work:

1) __weak and __strong pointers
- if we use the libobjc GC, do we need that?
- alternatively, we could try to emit code that registers the weak and strong pointers with the GC

2) @optional, @required
- does only compile time flagging of a method table created for that class
- checks if all @implementations of a class using this protocol implement them all (if required)
- and copy the default implementation from the @protocol if not
- this means that the symbol table tracks all @implementations and their method names and compares with the @protocols
- or we simply remove all @optional methods from the output - objc-1.0 does then check all remaining @required methods
- and if an optional method has an @implementation without @interface or @protocol, objc-1.0 would simply deduce it
- only issue with this approach: using @optional methods in DO?

3) __attribute__
- add to syntax
- can otherwise be ignored

4) @property (ivar = anInstanceVariable, copies, setter = aSetMethod:) int aProperty;
- generates a simple ivar
- but remembers the attribtes and the getter/setter method name in the ivar symbol table for that class (so we need a class table)
- object.path.path would translate to e.g. [object valueForKey:@"path.path"] or a getter or a setter call if such exists
- when reading a @property in a @interface context, the code for the setter method should be prepared
  and be added to the @implementation of the class

4b) @synthesisze
- generate getter/setter code

5) for(NSString * string in anArray) { NSLog(@"%@", string); }
- translate to
	{
	NSString *string;
	NSEnumerator *e=[anArray objectEnumerator];
	while((string=[e nextObject]))
		{ NSLog(@"%@", string); }
	}

- what if somebody implements countByEnumeratingWithState:objects:count: for a private collection class?
- well, it would simply not be used
- or we add an if([class respondsToSelector:@selector(countByEnumeratingWithState:objects:count:)])
- or we make a loop using this method and require NSObject to have a default implementation that falls back to nextObject

6) Blocks
- add ^syntax
- somehow translate into private functions and set up NSBlock objects

Material
--------
YACC tutorial:
	http://epaperpress.com/lexandyacc/download/lexyacc.pdf

MiniC sample:
	http://tinf2.vub.ac.be/~dvermeir/courses/compilers/minic/

Code of objc2pp in mySTEP:
	http://www.quantum-step.com/download/sources/mySTEP/objc2pp/

