[antlr-interest] Converting grammar from v2.7.7 to v3.0.1
Peizhao Hu
peizhao at itee.uq.edu.au
Thu Oct 11 23:17:40 PDT 2007
Hi all,
I would like to convert my old v2 grammar to the new v3 grammar with
parser and tree grammar structure. To my understanding, the parser is
for parsing a stream of input symbols, while the tree (AST) is for
evaluating the inputs. However, I would like to know a few things in
advance.
The file structure is the following:
1. a templates file (containing a number of TEMPLATE with a number #) in
the format of
========================
//
//COPYRIGHT
//
TEMPLATE #
<..expr..>
ENDTEMPLATE
//Comment
TEMPLATE #
<..expr..>
ENDTEMPLATE
//Comment
TEMPLATE #
<..expr..>
ENDTEMPLATE
ValidateCode xxxxx
========================
2. a binary file encoded using appropriate Template #
What I want to do is to firstly parse the whole templates file, build
AST trees for each template block, and invoke an action to verify it
with the validation code (this is the indexing process).
And when a binary file is provided, it should decode the binary file
according to template expressions specified in the template block of the
templates file. The template # is specified in the beginning of the
binary file.
So as the second stage, I would like to reuse only a block of the tree
grammar (without re-parsing the template block) from the indexing
process to parse the template expressions and invoke actions
interactively with the binary file.
as a newbie to the ANTLR v3 (parser and tree grammar concept), I am not
sure whether this is feasible.
Thanks in advance!
--
regards;
Peizhao
More information about the antlr-interest
mailing list