Difficulty with character having special meaning after new line

40 views
Skip to first unread message

Peter Frazer

unread,
Sep 5, 2012, 12:01:43 PM9/5/12
to gold-pars...@googlegroups.com
I am trying to define a grammar in which the character '*' starts a line comment if it is the first character on a line and am having difficult distinguishing it from a multiply symbol (also '*' but never at start of line).

I am currently using GOLD Parser Builder 3.0.1 as I have some problems with the new .egt format.  I found a comment in the documentation about 'older grammars using regular expressions to define comments' but I could not figure out how to do it.  I tried a variety of things like {CR}'*' but whatever I try I get an error either in building the grammar or in parsing.

The '*' could also start a comment at the very beginning of the file.

Any suggestions greatly appreciated.

Peter.

Devin Cook

unread,
Sep 5, 2012, 4:26:33 PM9/5/12
to gold-pars...@googlegroups.com
Are you parsing COBOL? Are new-lines significant in the grammar? In
may older language like COBOL and FORTRAN, they use a preprocesser
that removes these lines before the text is parsed.

- Devin Cook
> --
> You received this message because you are subscribed to the Google Groups
> "GOLD Parsing System" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/gold-parsing-system/-/FRSJtFNv7o4J.
> To post to this group, send email to gold-pars...@googlegroups.com.
> To unsubscribe from this group, send email to
> gold-parsing-sy...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/gold-parsing-system?hl=en.

Peter Frazer

unread,
Sep 6, 2012, 3:57:32 AM9/6/12
to gold-pars...@googlegroups.com, mi...@devincook.com
Thank you Devin,

I was considering custom code in the lexer to deal with this and I guess that is what I need to do.  But a grammar based approach seemed more elegant.

As a matter of interest is it / was it possible to use regular expressions in the definition of comments and if so how? 

I still haven't completely found my way around the documentation, is there a master index to all pages somewhere?

Peter.
> gold-parsing-system+unsub...@googlegroups.com.

Devin Cook

unread,
Sep 8, 2012, 3:00:08 PM9/8/12
to gold-pars...@googlegroups.com
The documentation, on the site, is pretty lacking... :(

In this case, it seems that the grammar is context-sensitive. The
location of the asterisk, on the screen, impacts how it is viewed. It
will probably be easier to write a simple preprocessor that removes
the commented lines. The resulting temporary file can be fed to the
parser.

Have a great day,
>> > gold-parsing-sy...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/gold-parsing-system?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "GOLD Parsing System" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/gold-parsing-system/-/FSA2HTBwJLUJ.
>
> To post to this group, send email to gold-pars...@googlegroups.com.
> To unsubscribe from this group, send email to
> gold-parsing-sy...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages