[antlr-interest] Typographing text with antlr

Serega Sheypak serega.sheypak at gmail.com
Sat Jan 23 03:55:04 PST 2010


Hi guys, I've really impressed with the power of ANTLR.
I need your advice.
I would like to develop typograph application. I've tried to do it with the
help of regular expressions, but it's extremely hard to maintain it. I write
crazy rregex and in few months I'can get how does it work:)
Typical situation when work with complicated regex'es. I've seen named regex
in Ruby (I use Ruby, Rais, Groovy, Java, JavaFX) but they don't bring so
clear evidence like ANTLR does.
Nice declarative ANTLR style should help a lot.

I am from Russia and I'm working with web texts in Russian.
Please, see short description of the task.

ANTLR based (Target lang -> Ruby) application accepts usual text typed in
browser.
Application should apply several characters transformation rules and emit
well-typographed text.

Example rules are:
1. "Something in quotes" -> «Something in quotes »
2. "Some text goes nere "Oh, my something in quotes again!" " -> «Some
text goes here „Oh my something in quotes again!“ »
3. (r)  -> *®*,
4. (c) -> *©*,
5. (tm) -> ™
6. someWord-someOtherWord -> someWord – someOtherWord

Special rule for first quote
7. "some text goes here... -> <span style="margin-right:0.44em;">
&laquo;</span>some text goes here...

and many other rules.

The first I would like to do it for Russian lang, nex will be English.

What do you think, is ANTLR nice for such task, is it convenient to solve
such task using ANTLR?

Thank you for your attention, waiting for your considerations.


More information about the antlr-interest mailing list