[antlr-interest] Problem with AST parsing for ST

Nauman recluze at gmail.com
Tue May 12 06:22:14 PDT 2009


Thanks a lot Michael. That was the problem. Now that I know it, I can't see
how I could've missed it!

On Tue, May 12, 2009 at 1:07 PM, Michael <micha-1 at fantasymail.de> wrote:

> Am Tuesday 12 May 2009 08:35:29 schrieb Nauman:
> > Hi all,
> >
> > I'm trying to parse a high level policy and generate a low-level
> structured
> > text.
> >
> > The grammar rule for policy set and policy are:
> >
> > policyset
> >         (policy)+
> >         -> ^(POLICYSET  policy+);
> >
> > and
> >
> > policy    : policyType^ LBRAC! targetType RBRAC!
> >             LBRACE!
> >             conditionStat?
> >             RBRACE!
> >             ->  ^(POLICY targetType conditionStat)
> >
> > The generated tree look like this:
> >
> > (POLICYSET (POLICY (SUBJECTS Doctor) (OBJECTS PatientRecord) (RIGHTS
> Read)
> > (CONDITION (and (= (. PatientRecord Appointment) True) (< (. Doctor
> > NoOfTimesRead) 5)))))
> >
> > The rule for policyset in the tree grammar is as follows:
> >
> > policyset:  ^(POLICYSET  (p+=policy)+) -> policySet(policies={p}) ;
> >
> > and policy looks like this:
> >
> > policy: conditionStat
> >      -> policyStat(cond={$conditionStat.st})
> >     ;
>
> should the policy rule in the tree grammar match the generated tree?, like:
>
> policy: ^(POLICY targetType conditionStat) ->
>        policyStat(cond={$conditionStat.st})
>
>
> cheers,
>  Michael
>



-- 
Nauman

Research Associate
Security Engineering Research Group
Institute of Management Sciences
Peshawar, Pakistan

Blog: http://recluze.wordpress.com
Group: http://serg.imsciences.edu.pk
Wiki: http://serg.imsciences.edu.pk/wiki
Art gallery: http://recluse.gfxartist.com

Contact number: +92 (0) 323 93 66 136
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090512/ceefc1e9/attachment.html 


More information about the antlr-interest mailing list