How do I fetch tokens on demand not all at once up front?(ANTLR 3)
CommonTokenStream sucks in all tokens up front until EOF. This works fine for files, but does not work for interactive programs or programs sucking from a socket. I will add a class to handle this to v3.2 probably. In the meantime, here is one I'm using ... Other labels:
buffering
How can I emit more than a single token per lexer rule?(ANTLR 3)
Here is a rule to match floats: NUMFLOAT : DIGITS '.' (DIGITS)? (EXPONENTPART)? (FLOATTYPESUFFIX)? '.' DIGITS (EXPONENTPART)? (FLOATTYPESUFFIX)? DIGITS EXPONENTPART FLOATTYPESUFFIX DIGITS EXPONENTPART DIGITS FLOATTYPESUFFIX ; Now if you want to add '..' range operator so 1..10 makes sense ...
Token stream rewriting with rewrite rules(Terence Parr)
Let's talk tree and token stream rewriting. Starting with simple token rewriting. I've thought about this and I think we can fold rewriting patterns into grammar composition and token stream stuff. Here's a simple rule that just replaces ... Other labels:
rewriting, channels