Rex & Racc : howto?

Hello.

I’m looking for documentation on rex & racc, as what I have found up to
now
(mainly the homepages and the READMEs) are rather terse.

Any pointers or examples of use?

Thanks.

I’m looking for documentation on rex & racc, as what I have found up to now
(mainly the homepages and the READMEs) are rather terse.

I haven’t run across any rex and racc tutorials online, but there are
is a solid example parser buried inside the rex tarball distribution.
The ‘calc3’ example consists of two source files:
calc3.rex → The rex token definitions
calc3.racc → The racc grammar definitions and executable script

They demonstrate many of the differences in coming from lex and yacc.

If you aren’t familiar with the traditionally C-based lex and yacc,
they have been in wide use for a (relatively) long time and are well
documented online. I would suggest starting with their documentation
if you are just getting started with parsers, or even LALR parsers. A
good introduction can be found here:

If you aren’t set on using an LALR parser, then the Treetop library is
an interesting alternative. It uses a very different method of
generation, but it’s become a popular Ruby tool. It can be found here:
http://treetop.rubyforge.org/

Let us know if this doesn’t answer your question. Good luck!

-Nick

On Jun 21, 2008, at 09:58 , [email protected] wrote:

They demonstrate many of the differences in coming from lex and yacc.
generation, but it’s become a popular Ruby tool. It can be found here:
http://treetop.rubyforge.org/

Let us know if this doesn’t answer your question. Good luck!

This is all good advice. For a more complicated racc example (doesn’t
use rex), look at ruby_parser. It is big and gross, so it better
simulates what all yacc-based grammar definitions eventually become. :slight_smile:

[email protected] wrote:

I’ve read (a good part of) the lex&yacc book, and read online documentation.
I don’t know about Treetop, but will look into it.

upside: It can parse non-context free grammars, which the others find
hard or impossible.
upside: They’re as efficient as context-free ones.
downside: That’s not very efficiently… it’s quite slow.
downside: You have to have all your input in one string to use it - no
IOStreams.

It is very sweet and clean and all kinds of good things, and since
you’re
using Ruby already you might not be too worried about performance :-).

Clifford H…

Thanks for the answers.

I’ve read (a good part of) the lex&yacc book, and read online
documentation.
I don’t know about Treetop, but will look into it.

Please look at the headers of a ruby-talk email.

robert

2008/6/25 Fred C. [email protected]:

And if you don’t have a clue of what a “header” is:

X-ML-Name: ruby-talk
X-Mail-Count: 306167
X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only
members can post)
X-ML-Info: If you have a question, send e-mail with the body
“help” (without quotes) to the address [email protected];
help=mailto:[email protected]?body=help
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on

On Wed, Jun 25, 2008 at 1:03 PM, Robert K.

Dear all
i would like to remove myself from this ruby-talk, how do i go about?

2008/6/25 J-H Johansen [email protected]:

And if you don’t have a clue of what a “header” is:

X-ML-Name: ruby-talk
X-Mail-Count: 306167
X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only
members can post)
X-ML-Info: If you have a question, send e-mail with the body
“help” (without quotes) to the address [email protected];
help=mailto:[email protected]?body=help
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on

You omitted the interesting bit:

List-Id: ruby-talk.ruby-lang.org
List-Software: fml [fml 4.0.3 release (20011202/4.0.3)]
List-Post: mailto:[email protected]
List-Owner: mailto:[email protected]
List-Help: mailto:[email protected]?body=help
List-Unsubscribe: mailto:[email protected]?body=unsubscribe

Cheers

robert

On Wed, Jun 25, 2008 at 9:20 AM, Robert K.
[email protected]
wrote:

   help=<mailto:[email protected]?body=help>

On the other hand, I’d venture to guess that a large proportion of
people
who need to resort to sending a post to a list to ask how to unsubscribe
don’t know how to view the headers.

Many popular mail-clients bury headers under one or more levels of
user-friendliness. For example gmail, has a show details link, which
DOESN’T show the headers. You have to click on a pull-down list next to
the
reply link and select " Show original"

So, for the OP if you still haven’t managed to unsubscribe, the way to
do it
is to send an email from the email address which is receiving the
postings
to [email protected] with just the text unsubscribe as the
body of
the email.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

grrr … I’ll have to learn to use page-down key.

cheers =)

On Wed, Jun 25, 2008 at 3:20 PM, Robert K.