[antlr-interest] (no subject)

Sam Harwell sharwell at pixelminegames.com
Wed Nov 12 10:49:51 PST 2008


ANTLR would work since the format is well-defined, but based on what
you've said about the format it may be massive overkill if the target
language has good regex & string operations support. On the other hand,
a simple format like this would be a great learning opportunity, so I
say go for it. J

 

There are many examples on the ANTLR site:

http://www.antlr.org/grammar/list

 

You might start with this one. It's another line-based simple text
format:

http://www.antlr.org/grammar/1205078833386/StackTraceText.g

 

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Mark Darnell
Sent: Wednesday, November 12, 2008 12:41 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] (no subject)

 

I have a requirement to parse a text report in the following format:

SUBJ:  <<report subject>>

A. <<report_type>>/YY/NNNNN/NNNN

B. YYMMDD/HHMM:SS

C. <<field1>>/<<field2>>

D. <<line#>>/<<field3>>/<<field4>>/<<field5>>/<<field6>>

   <<line#>>/<<field3>>/<<field4>>/<<field5>>/<<field6>>

 <<some text would go here>>

E. <<some text would go here>>

I was wondering if ANTLR would be a help in parsing this type of text
file. I need to get the items marked as fields into an XML file that is
later parsed by another system.

If ANTLR is a good fit, could you point me to some examples of writing a
grammar for text file parsing?

Mark Darnell

BIT Systems, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081112/0780da12/attachment.html 


More information about the antlr-interest mailing list