Dashboard > ANTLR 3 > ANTLR 3 Wiki Home
  ANTLR 3 Log In | Sign Up   View a printable version of the current page.  
  ANTLR 3 Wiki Home
Added by Terence Parr, last edited by Kunle Odutola on Oct 24, 2007  (view change)
Labels: 
(None)

Welcome

Welcome to the ANTLR Project wiki.

This ANTLR 3 wiki complements and supports the ANTLR 3 website. Inside the wiki you will find documentation, tutorials and a FAQ.

We hope that you find what you need to learn more about ANTLR 3 on this wiki. If this is not the case, you may register and help (please read our entire welcome message first).

To get started with ANTLR, jump to FAQ - Getting Started. If you run into trouble, ANTLR has a mailing list full of helpful ANTLR fans.

 
Recently Updated
by Terence Parr (7 hours ago)
Re: How do I install this damn thing?
by David Kent Snyder (7 hours ago)
Re: How do I install this damn thing?
by Johannes Luber (9 hours ago)
Antlr 3 CSharp Target
by Robert van Poelgeest (09 May)
Re: Antlr 3 CSharp Target
by Terence Parr (08 May)
Re: FAQ - Runtime libraries
by Kaleb Pederson (06 May)
C runtime
by Johannes Luber (02 May)
Left-Recursion Removal - Print Edition
by Johannes Luber (02 May)
3. Rule Normalization
by Johannes Luber (02 May)
2.6 Rule Inlining post_decrement_expression
by Johannes Luber (02 May)
2.5 Rule Inlining post_increment_expression


Currently syntax errors cause invalid trees and possibly even runtime exceptions when building ASTs. What we really need I believe is to have rules that encounter syntax errors return an ERROR node of some sort that records where the error occurred and, with luck, the tokens consumed during recovery. I started an improvement request:

http://www.antlr.org:8888/browse/ANTLR-193

The basic idea is that ERROR nodes get used in place of ASTs that would normally be produced by rule indications....

Posted at 09 May @ 11:14 AM by Terence Parr | 0 comments
Last changed May 03, 2008 10:43 by Terence Parr

just had some cool ideas about a semantic rule specification language...i should write that up too... (also think about multi-threaded rewriting; no side-effects required

Some language translation problems can be described with a few rewrite rules that are predicated upon their context and potentially an arbitrary Boolean expression. For example, consider a few identity transformations such as


expr: // in context of expr, match left side,...

Posted at 11 Apr @ 3:00 PM by Terence Parr | 0 comments
Last changed Apr 11, 2008 11:37 by Terence Parr

Currently ANTLR does not create templates for you automatically when you use output=template option. This is because, when I first implemented it, I had no idea what the right answer was here. I did not know how to deal with whitespace and so on. I think I have the answer now. First, let me remind you that output=AST builds a completely flat tree given no instructions to the contrary. Similarly, the template output should reproduce the input given no instructions.

...

Posted at 11 Apr @ 11:09 AM by Terence Parr | 0 comments
Last changed Apr 11, 2008 11:08 by Terence Parr

Ok, Kay Roepke is in town and we've been discussing the faster expression parsing, among other things. Look for another entry on default StringTemplate generation or a parsing and tree parsing.

ANTLR v3.2 will allow special rules for specifying expressions that are particularly efficient both in speed and space. Special rules will define either unary suffix operators, binary operators, or trinary operators by virtue of how they recurse....

Posted at 10 Apr @ 1:49 PM by Terence Parr | 0 comments
Last changed Apr 08, 2008 15:23 by Terence Parr

I should be working on something else but got to thinking about how annoying it is specifying expressions in recursive descent parsers. You have to have a new rule for each precedence level. This is also very slow. Just to match 34 it has to descend about 15 method calls. I built a prototype single-rule (plus primary and suffix) operator matching thingie which I enclose below. I should be able to generate it from some metameta syntax in antlr. For example,...

Posted at 23 Mar @ 11:12 AM by Terence Parr | 0 comments

I'll be giving a keynote lecture at this year's conference on program comprehension in Amsterdam if anybody's interested in going:

http://www.cs.vu.nl/icpc2008/keynote.php

I think I will also be giving a talk at CWI. June 10-13.

Posted at 07 Mar @ 1:44 PM by Terence Parr | 0 comments

Feb 21, 2008 in New York City. See http://semweb.meetup.com/25/ for more information.

Posted at 31 Jan @ 11:20 AM by Terence Parr | 0 comments
Last changed Oct 11, 2007 12:22 by Terence Parr

I replaced my blocking queue sitting between pipeline actors (threaded consumer/producers) and speed of my word freq program dropped from 5.2s to 3.5s on 5M file simply by replacing the blocking queue with my new ping-pong buffered version. That is close to the 3.0s achieved by the nonthreaded version.

// threaded, pipeline version; 3.5s (from 5.2s) on 5M file
f => Words() => { string w | ... }

// nonthreaded, nested map operation on big list; 3.0s
f....

Posted at 11 Oct @ 12:12 PM by Terence Parr | 2 comments

So I am narrowing down my understanding of how to use mixins. The Comparable example is awesome, but does not need fields. In my effort to reduce the size of the average mantra object, I needed to remove the in and out fields from every object. The should be moved to an element that all of the actors can include or inherit from. I did not want to force all actors to inherit from the same base class, so I decided that a mixin was perfect but mixins don't currently allow fields....

Posted at 08 Oct @ 10:23 AM by Terence Parr | 0 comments

Finally got something ready for people to look at. Main components are in.

http://www.linguamantra.org/

Posted at 05 Oct @ 6:44 PM by Terence Parr | 2 comments
Last changed Oct 03, 2007 14:07 by Terence Parr

Awesome. Mantra does a dynamic mixin. Just map a string to a closure with "self" as first arg:

int.mixin("toHex",
   {int self | return java {new mstring(Integer.toHexString(((mint)self).v))};}
);
println(32.toHex()); // emits 20, the hex verison of 32. :)

also note you could alter the MetaClass per object (set .class field) to alter behavior per instance! You can ask about meta object now:

println(32.class); // emits <int>

To avoid strange bugs,</int>...

Posted at 03 Oct @ 2:04 PM by Terence Parr | 0 comments

Check this out:

ErrorMgr errors = ErrorMgr(); // answers error()
Vehicle.delegate(errors);
Car c = Car(); // car does not answer error()
c.error("we crashed");

here I am calling the delegate method on the Vehicle class, of which Car is a subclass. I make an instance of a car and then send it the error message, which is forwarded to the error manager....

Posted at 02 Oct @ 8:19 PM by Terence Parr | 0 comments
Last changed Sep 30, 2007 19:58 by Terence Parr

See http://www.linguamantra.org for more information.

Type annotations

Mantra is not a statically typed language like Java, though you'll see types specified in the code. These types are annotations kind of like "executable documentation". For example how many times have you done this in other dynamically typed languages like Ruby and Python:


f(a): ......

Posted at 30 Sep @ 7:51 PM by Terence Parr | 0 comments
Last changed Sep 21, 2007 13:58 by Terence Parr

Mantra is coming along nicely. Added type annotations, but am not doing anything with them yet.  Without much optimization (and huge amounts of memory allocation), Mantra loop and list append are looking good:

a = [];
1..5000000:{int i | a += i;};

The equivalent python:

a = [];
for i in range(5000000):
        a.append(i);

My unscientific wallclock measurements on my dual cpu mac (powerpc) with Java 1.5 shows Java doing about 3.0s vs 3.9s in python....

Posted at 21 Sep @ 1:56 PM by Terence Parr | 3 comments
Last changed Aug 16, 2007 09:47 by Terence Parr

Heh, thanks to the hard work of the target developers, 3.0.1 is now available:

http://www.antlr.org/download.html

Java, C, Python, C# targets are available; others coming.

Here are the changes:

http://www.antlr.org/doc/README.txt

Essentially, this is a bug fix release with a number of improvements to the debugging protocol that communicates with ANTLRWorks. Oh, and I added:

org/antlr/runtime/tree/TreeWizard....

Posted at 16 Aug @ 9:47 AM by Terence Parr | 0 comments

Wiki Contents

ANTLR v3 documentation (ANTLR 3)
ANTLR v3 FAQ (ANTLR 3)
ANTLR v3 To Do List (ANTLR 3)
Examples (ANTLR 3)
Grammar Design Patterns (ANTLR 3)
Presentations (ANTLR 3)
Terence Notes (ANTLR 3)
Tutorials (ANTLR 3)
Using ANTLR (ANTLR 3)
Using ANTLR with XML (ANTLR 3)

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators