grammar files for a shell

J

junky_fellow

Hi,

Is any one aware of some link that has the grammar files (yacc and lex
files)
for command interpreter like shell ?

thanks a lot for any pointers ....
 
M

Mark McIntyre

Hi,

Is any one aware of some link that has the grammar files (yacc and lex
files) for command interpreter like shell ?

This is not a C question.
thanks a lot for any pointers ....

www.google.com ?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
R

Rod Pemberton

Hi,

Is any one aware of some link that has the grammar files (yacc and lex
files)
for command interpreter like shell ?

No. But, I may have found one for you. I searched the collection I have of
yacc/lex based programs. I have many for programming languages or C tools.
Most of the others you'll find are for regular expressions, REXX, SQL,
ftp/html parsers, or simple calculators.

I searched via Yahoo and found a shell based on Duff's RC (run command)
shell. It has the yacc file (parse.y). But, it is missing the lex file,
although most of it's content is in their man page (rc.1). It appears they
converted the lex file to a dedicated C lexer (lex.c), probably for speed.
However, I think there is enough of the lexer on the man page that you could
recreate or complete a 'lex.l' to work with parse.y.

http://gatekeep.cs.utah.edu/ftp/hpux/Shells/rc-1.7.1/rc-1.7.1-src-11.11.tar.gz

Duff wrote the RC version for Plan 9.
http://cm.bell-labs.com/sys/doc/rc.html

It's somewhere, buried here, supposedly... (If you go this route, good
luck!):
http://cm.bell-labs.com/plan9/index.html


I haven't looked at any of the source other standard shells. Some of them,
or early versions of them, may have been lex/yacc based. Another option
would be to scour the pre-94 *nix part of the Internet for "dead" shells:
Decus, gatekeeper, net.sources, comp.sources.misc, comp.sources.unix, etc...
perhaps using Google, Yahoo, or Google's Groups advanced search.


Rod Pemberton
 
J

junky_fellow

yacc/lex based programs. I have many for programming languages or C tools.
Most of the others you'll find are for regular expressions, REXX, SQL,
ftp/html parsers, or simple calculators.

I searched via Yahoo and found a shell based on Duff's RC (run command)
shell. It has the yacc file (parse.y). But, it is missing the lex file,
although most of it's content is in their man page (rc.1). It appears they
converted the lex file to a dedicated C lexer (lex.c), probably for speed.
However, I think there is enough of the lexer on the man page that you could
recreate or complete a 'lex.l' to work with parse.y.

http://gatekeep.cs.utah.edu/ftp/hpux/Shells/rc-1.7.1/rc-1.7.1-src-11....

Duff wrote the RC version for Plan 9.http://cm.bell-labs.com/sys/doc/rc.html

It's somewhere, buried here, supposedly... (If you go this route, good
luck!):http://cm.bell-labs.com/plan9/index.html

I haven't looked at any of the source other standard shells. Some of them,
or early versions of them, may have been lex/yacc based. Another option
would be to scour the pre-94 *nix part of the Internet for "dead" shells:
Decus, gatekeeper, net.sources, comp.sources.misc, comp.sources.unix, etc...
perhaps using Google, Yahoo, or Google's Groups advanced search.

Thanks a lot Rod. The links are really useful and this is what I was
looking for.
thanks again ...
 
R

Rod Pemberton

Thanks a lot Rod. The links are really useful and this is what I was
looking for.
thanks again ...

You're welcome.

I only have a modest amount of experience with flex & bison, but, if your
having problems with the lex grammar, just ask. If I don't know, I can
probably still point you to working flex/lex code or one of twenty or so
webpages on flex/bison/lex/yacc with the information you need. Although I
haven't read it in a while, the moderated newsgroup comp.compilers (requires
a valid email account to post) discusses grammars much more than here. It
also has a small file archive with some very simple grammars:
ftp://ftp.iecc.com/pub/file/ .

If you didn't know, you can search comp.compilers or the others I mentioned
here: http://groups.google.com/advanced_search?hl=en


Rod Pemberton
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top