It is all text, and it's meaningless

time to read 2 min | 333 words

I'm pretty interested in compilers and text analysis, so I spent several hours today trying to grok ANTLR. I can work my way through some of the samples, and even figure out what the stuff is doing, but I can't seem to make stuff work when I try to go forward on my own.

I want to be able to get an AST from ANTLR for the following text:

from Foo select Foo.Bar

And I want the AST to look like this:

  • from:
    • Name: 'Foo'
  • select:
    • Reference:
      • Left: 'Foo'
      • Right: 'Bar'

I can get a lexer to work, and I think I got the parser as well. My problem is that I can't seem to step forward from there to get it working with trees and more reasonable information. There is a wealth of information, but I think that I'm missing the background to understand it :-(