Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Objective-C target

Author

Kay Rรถpke
kroepke(at)classdump(dot)org

Status

As of mid September '06 it can build ASTs and tree parsers are working. (smile)
The next ANTLR beta release will include a working Xcode plugin, so you can automatically generate your grammars from within Xcode.
It automatically tracks all the dependencies between the different grammars in your project to build them in the right order.
Common error messages and warnings are picked up for display in Xcode using the new _-message-format gnu_ option@Command+line+options in ANTLR.
There remain some errors and warnings which cannot be picked up yet, due to missing information in ANTLR itself, but this will change in the future.

ANTLR.framework

Features (partially) missing are:

  • Scopes
    • multiple return values need testing/enhancements
  • Labels
    • other labels
  • Tests - well, most of them
  • Template support (this will be a lot of work (sad))

Features completed:

  • Single rule return values
  • FOLLOW sets (bitsets)
  • cyclic DFAs
  • Scopes
    • dynamic scopes
    • rule parameters
  • Labels
    • token reference labels
  • Syntactic Predicates
  • Semantic predicates
  • Tree support (output=AST)
  • Tree parsers

ANTLR Xcode plugin

Features missing:

  • Syntax highlighting & function popup support (I'd still encourage you to use ANTLRWorks for development!) For this I need more understanding of the dreaded classes Xcode uses internally, to be able to replace them with ANTLR3 (smile)
  • Debugging (long term goal)

Features completed:

  • Build settings you can pass to org.anltr.Tool
  • Dependency calculation
  • Code generation
  • Most common warnings & error messages are sent to Xcode, syntax errors in the grammar aren't correctly reported yet.
  • Basic syntax highlighting works, using the standard Xcode mechanisms

Roadmap

Building ASTs and tree parsers is working now. ANTLR.framework is known to be Universal.
I will use v3 to write a number of different small applications in order to find out about all the small bugs that are hiding in the corners. Thus development will probably not be milestone based, but rather fix-as-they-come-up.
Regarding the template output support of v3, this will require an Objective-C implementation of ST, which will take a lot of time. So don't expect that for 3.0.
Soon I will add debugging support to the code generation and add a bit to ANTLRWorks to make it support debugging Objective-C based grammars in their natural environment (=your application) or as simple standalone recognizers.
There is a Xcode plugin available in the depot, which will be part of the next beta release. Contact me if you need binaries.

Platforms

I will only concern myself with the Mac. There will be no GNUStep support.
As for Mac OS versions, I aim to be compatible with at least 10.3 as a target platform, though the Xcode project will require the latest version available, since it really doesn't make a lot of sense to use it in an earlier version.
The Xcode plugin requires at least Xcode 2.3.
Currently ANTLR requires 10.4. Unless there are very good reasons to support versions prior to that, it will not get priority.

Runtime

The runtime will be built in terms of the NS* level of classes, and is probably not very optimized in the first versions. I'll identify hotspots later and maybe add a CF-based runtime for speed if it turns out to be a problem.
The layout of the runtime is essentially the same as the Java version, though subtle differences will be visible where it makes it more natural to the Objective-C programmer. Naming of classes and methods may be slightly different and sometimes inner workings are too.
Initial tests don't show serious performance problems, though I'm sure there will be opportunities for optimization.
The biggest problem at the moment are the numerous unused variables created at the moment. Often ANTLR will build up lists of tokens but subsequently not use them in any significant way, which leads to wasting time and space. This can only be fixed in the ANTLR code generator and not for individual targets. I am looking into this.

Examples

The goal is to provide the complete set of Java-based examples in Objective-C for comparison. There may be additional examples contained in the Xcode project. These exist mainly for development purposes as testcases, or to try out features.
I am currently working on an editor for StringTemplates as a big "example"/testcase for v3.
Also take a look at the Xcode plugin that uses a filtering lexer written using ANTLR to figure out grammar types and dependencies.

  • No labels