🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Ray Nickson Sun, 06 Aug 1989 23:21
function foo { echo foo; } doesn't parse right
#444
Author: Ray Nickson
Date: Sun, 06 Aug 1989 23:21
17 lines
1223 bytes
help function appears to claim that the above syntax is a legitimate
function definition, but bash (1.02, gcc-compiled, BSD on an HP300,
not that it matters) claims that there is a `syntax error near `{''.
The problem appears to be that although the yacc parser has a separate
production for this case, the lexer never allows it to see a `{'
unless it occurs immediately after a `()' pair.

An (unrelated) bug which doesn't cause any problems is in
`reserved_word_acceptable'; this is declared to take an argument,
which it completely ignores.  I wonder whether some minor attention
could result in a significantly cleaner, easier to understand lexer
and parser.

-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand.
nickson@comp.vuw.ac.nz       ...!uunet!vuwcomp!nickson      + 64 4 721000x8593
function foo { echo foo; } doesn't parse right
#447
Author: Brian Fox
Date: Tue, 08 Aug 1989 02:16
29 lines
1630 bytes
   Date: Mon, 07 Aug 89 11:21:10 +1200
   From: Ray Nickson <nickson@comp.vuw.ac.nz>

   help function appears to claim that the above syntax is a legitimate
   function definition, but bash (1.02, gcc-compiled, BSD on an HP300,
   not that it matters) claims that there is a `syntax error near `{''.
   The problem appears to be that although the yacc parser has a separate
   production for this case, the lexer never allows it to see a `{'
   unless it occurs immediately after a `()' pair.

Thanks, fixed.

   An (unrelated) bug which doesn't cause any problems is in
   `reserved_word_acceptable'; this is declared to take an argument,
   which it completely ignores.

That was preparation for the future, and the future took place after
1.02 but before 1.03.

   I wonder whether some minor attention could result in a significantly
   cleaner, easier to understand lexer and parser.

If you would like to write a "significantly cleaner, easier to
understand" parser, by all means, please do!  I would be glad to
include/use any code which I find to be clean, especially if it is
cleaner than what is already in use.

Brian
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads