Creating {Upper Printable} and {Upper Letter} sets

16 views
Skip to first unread message

esmit...@gmail.com

unread,
Apr 29, 2008, 12:24:28 AM4/29/08
to GOLD Parsing System
Newbie question. Trying to define subsets of {Printable} and {Letter}
that exclude lowercase a-z.

Could someone please tell me how to do that?

Thank you,
Eric kd5uwl

esmit...@gmail.com

unread,
Apr 29, 2008, 10:02:03 PM4/29/08
to GOLD Parsing System
On Apr 28, 11:24 pm, esmithm...@gmail.com wrote:
> ... Trying to define subsets of {Printable} and {Letter}
> that exclude lowercase a-z.

Er -- my grammar (to date) can be seen here:
http://www.nutstreet.net/prog/avr/basic/BASIC-64avr.html

This is a "hybrid" of the BASIC-64 and Commodore Pet BASIC grammars
found on the GOLD website, with some minor changes. I used primarily
the BASIC-64 grammar but added the <Value> definition from the Pet
grammar in order to add basic functions (INT, SQR, etc). I _tried_ to
do this on my own before I had seen the Pet example, and was really
pulling my hair out. It didn't occur to me to put it in the <Value>
definition. Gee, some aspects of this seem so straightforward, but
this certainly wasn't for me. At first I tried adding the function
definitions as part of <Expression>, and what at first seemed ok --
would parse

10 X=SQR(Y)

and

10 X=SQR(SQR(Y))

but would not parse

10 X=SQR(Y)+SQR(Z)

So, I looked around for examples and found the GOLD site Pet grammar
which had these functions. I added the <Sub Exp> definition and
replaced my <Value> with the Pet one, and now the grammar I'm working
on will parse.

But I don't want to have the lower case -- my hardware (an ATmega644)
is currently programmed to turn everything into uppercase (I've
already written the input system, memory management, and even an
EEPROM "filesystem". Now I'm working on the parser) -- and since I'm
doing that I wanted to setup the grammar to only deal with uppercase.
But I can't figure out how to modify the {Letter} and {Printable}
definitions to do so. Presumably I need to subtract something, but I
keep seeing both the upper- and lowercase letters in the DFA state
tables.

So I'm wanting to create something like an {Upper Printable} and
{Upper Letter} (again, presumably by subtracting something from
{Printable} and {Upper}) -- but if someone could please _show_ me how
to do that, it would certainly be a huge help...I'm really having
trouble with it.

Thanks,
Eric kd5uwl

ps THANK YOU to the developer(s) of GOLD -- absolutely amazing.

Devin Cook

unread,
Apr 30, 2008, 1:26:36 PM4/30/08
to gold-pars...@googlegroups.com
Set the case sensitive attribute to false:

"Case Sensitive" = False

Have a great day.

- Devin

Dave Dolan

unread,
Apr 30, 2008, 1:30:51 PM4/30/08
to gold-pars...@googlegroups.com
subtract a range of characters (see the help file for gold, it's actually helpful!)
 
Upper = {Letter} - [abcdefghijklmnopqrstuvwxyz]
 
There!

Dave Dolan

unread,
Apr 30, 2008, 1:32:52 PM4/30/08
to gold-pars...@googlegroups.com
Er I mean {Upper} = {Letter} - [abcdefghijklmnopqrstuvwxyz]
 
I forgot the { } around the charset name.



Dave Dolan
Certified Computer Geek-inator
http://davedolan.com/blog
dave....@gmail.com



--
---------------------------------------------------------------
Dave Dolan
Certified Computer Geek-inator
http://davedolan.com/blog
dave....@gmail.com

esmit...@gmail.com

unread,
Apr 30, 2008, 10:33:23 PM4/30/08
to GOLD Parsing System

Thanks, Devin and Dave, but I had already tried both of those things
before posting here. Devin's suggestion, to set "Case Sensitive" to
false was already in his BASIC-64 grammar which I brought over. And I
also already had tried:

{Upper Printable} = {Printable} - [abcdefghijklmnopqrstuvwxyz]
{Upper Letter} = {Letter} - [abcdefghijklmnopqrstuvwxyz]

...then used only the new {Upper Printable} and {Upper Letter} in the
subsequent "BASIC-64" uses/definitions. But I still have both upper
and lower case in the DFA tables.

Now, I don't suppose it matters -- as I code the lexer (working on it
now) I'll simply not include the tests for the lower cases in any
state. I can't see that there would be any other impact to the state
tables than this.

But since you guys know (obviously!) that GOLD should work the way
you've described to me, then I'm convinced _I_ must have missed
something; I must have done something wrong... I just can't leave it
alone and will keep looking.

Thank you so much for your help -- and again, THANK YOU for such a
wonderful package.

Eric kd5uwl

Devin Cook

unread,
May 1, 2008, 3:58:47 PM5/1/08
to gold-pars...@googlegroups.com
After the system first looks at the grammar, check what is displayed in the
Parameter Window and also Character Set Window. I'm curious if this might be
a bug.

- Devin

esmit...@gmail.com

unread,
May 2, 2008, 9:28:43 PM5/2/08
to GOLD Parsing System
Hi, Devin,

> After the system first looks at the grammar, check what is displayed in the
> Parameter Window and also Character Set Window...

Thanks -- I'll have these results posted by morning.

Eric kd5uwl

esmit...@gmail.com

unread,
May 3, 2008, 10:51:49 AM5/3/08
to GOLD Parsing System
I made test runs on both Windows (XP) and on Linux using Wine (Windows
Emulator) with the same results. The Character Set window shows no
lowercase in any set, but the DFA state window does.

Please see screenshot here: http://www.nutstreet.net/prog/gold/GOLDParserBuilder-BASIC-64avr.grm.png

Please see complete grammar here: http://www.nutstreet.net/prog/gold/BASIC-64avr.grm

I have version 3.4.4 of the parser builder.

Please let me know if I'm missing something or doing something wrong,
and thank you!

Eric kd5uwl

Dave Dolan

unread,
May 3, 2008, 12:01:55 PM5/3/08
to gold-pars...@googlegroups.com
I can confirm this behavior in the builder tool.  Since it's almost unfathomable to imagine that its a display bug, it would have to be either something wrong with the engine that the builder is using, or, something wrong with the way the DFA file is actually being output.  I know that really narrows it down, but hey, it's in VB so I only gets ta guess!
Reply all
Reply to author
Forward
0 new messages