grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Grammatica-users] Negation in production rules


From: Per Cederberg
Subject: Re: [Grammatica-users] Negation in production rules
Date: Mon, 3 May 2010 19:05:43 +0200

I don't think this type of grammar is suitable for Grammatica, or any
other EBNF-based tool either for that matter.

Try looking into the Properties file format for Java and any
open-source parsers for that. There might be one or to you can tweak
for your use-case. Or just write your own, using indexOf("=") and
such.

Cheers,

/Per

On Mon, May 3, 2010 at 18:30, Andrew Smellie <address@hidden> wrote:
>
> Hi
>
> I have a very simple grammar that captures data of the form KEY=VALUE
>
> I have written the rule to parse a KEY, but the complexity comes in parsing 
> the data. It can span multiple lines, be of arbitrary length and data type 
> (int, float, date, string). In fact the only thing you can really say about 
> it is that it is not a KEY.
>
> I really want to say something like
>
> KEY=(NOT A KEY)
>
> and parse the three parts (KEY, EQUALS, NOT A KEY) accordingly.
>
> How do I write a production rule that says "not a token"?
>
>
>
> I have pasted some of the file below as an example:
>
> DATE="Thu Apr 22 20:41:15 2010"
>
> METHOD=AM1
>
> TITLE="Untitled-1"
>
> KEYWORDS=" AUX AM1 ALLVEC CHARGE=0 COSMO ESP ESR GRAPH HYPERFINE MULLIK POLAR 
> SHIFT=80 SPIN"
>
> COMMENTS=""
>
> ATOM_EL[0008]=
>
> C C H H H H H H
>
> ATOM_CORE[0008]=
>
> 4 4 1 1 1 1 1 1
>
> ATOM_X:ANGSTROMS[0024]=
>
> -0.3893 0.6545 0.0000
>
> 0.3893 -0.6545 0.0000
>
> 0.3150 1.5163 0.0000
>
> -1.0344 0.7137 0.9050
>
> -1.0344 0.7137 -0.9050
>
> -0.3150 -1.5163 0.0000
>
> 1.0344 -0.7137 0.9050
>
> 1.0344 -0.7137 -0.9050
>
> AO_ATOMINDEX[0014]=
>
> 1 1 1 1 2 2 2 2 3 4 5 6 7 8
>
> ATOM_SYMTYPE[0014]=
>
> S PX PY PZ S PX PY PZ S S S S S S
>
> AO_ZETA[0014]=
>
> 1.8087 1.6851 1.6851 1.6851 1.8087 1.6851 1.6851 1.6851 1.1881 1.1881
>
> 1.1881 1.1881 1.1881 1.1881
>
> ATOM_PQN[0014]=
>
> 2 2 2 2 2 2 2 2 1 1 1 1 1 1
>
>
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]