Rex & Racc : howto?

F

fdelente

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.
 
N

nicholasmabry

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:
http://epaperpress.com/lexandyacc/

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
 
R

Ryan Davis

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:
http://epaperpress.com/lexandyacc/

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!

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. :)
 
F

fdelente

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.
 
C

Clifford Heath

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 Heath.
 
J

J-H Johansen

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 (e-mail address removed);
help=<mailto:[email protected]?body=help>
X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on
 
R

Robert Klemme

2008/6/25 J-H Johansen said:
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 (e-mail address removed);
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
 
J

J-H Johansen

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

cheers =)

2008/6/25 J-H Johansen said:
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 (e-mail address removed);
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
 
R

Rick DeNatale

[Note: parts of this message were removed to make it a legal post.]

2008/6/25 J-H Johansen said:
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 (e-mail address removed);
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>

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 (e-mail address removed) with just the text unsubscribe as the body of
the email.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top