home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.30 / text0058.txt < prev    next >
Encoding:
Text File  |  1993-03-11  |  2.1 KB  |  59 lines

  1. Submitted-by: guenther@stolaf.edu (Philip Guenther)
  2.  
  3. I'm in the (slow) process of writing my own shell (yes, I know that
  4. this has become a cliche, but I'm doing it anyway, mostly to prove to
  5. myself that I really know C/UNIX (hah!)), and I'd like it to be POSIX
  6. compliant.  Thus, the inch think print out of 1003.2 next to me. :-)
  7.  
  8. However, after working with the grammer given in 3.10.2, and comparing
  9. it with other parts of the document, I have found a problem with the
  10. grammer as given: it contradicts the previous written specification.
  11. To be specific:
  12.  
  13. According to 3.9.4.3 (case Conditional Construct), the last case item
  14. doesn't need a ';;'.  Thus:
  15.  
  16. case $foo in
  17.   bar) echo baz;;
  18.   *) echo baz
  19. esac
  20.  
  21. is valid.  However, the grammer of 3.10.2 denies this by requiring the
  22. double semi.  As I see it, the relevant lines of the grammer should be
  23. changed to:
  24.  
  25. case_clause: Case WORD In linebreak case_list DSEMI linebreak Esac
  26.            | Case WORD In linebreak case_list                 Esac
  27.            | Case WORD In linebreak                           Esac
  28.            ;
  29.  
  30. case_list: case_list DSEMI linebreak case_item
  31.          |                           case_item
  32.          ;
  33.  
  34. case_item: pattern ')' linebreak
  35.          | pattern ')' compound_list
  36. ... etc
  37.  
  38. This unfortunately does possibly cloud what the units mean away from
  39. each other (a case_list doesn't include the final ';;'?), but it does
  40. fix this error in the grammer.  In addition, it makes the extension to
  41. the case sytax of ';&' meaning fall through to next case_item easier
  42. to add.
  43.  
  44. This leads finally to several questions: Can this amended in some way
  45. in future drafts? (Draft 11 is in my lap right now) Where does the
  46. final call come from when two parts of the standard are contradictory?
  47. Will there be POSIX Call For Interpretations ala ANSI C?
  48.  
  49.  
  50. Philip Guenther
  51. --
  52. guenther@stolaf.edu (Philip Guenther) St Olaf College, Northfield, MN 55057
  53. (setq sig-hook '(lambda () (dis-insert-disclaimer organization 'student)))
  54. "Life makes sense?  LIFE MAKES SENSE!?!?  Where do people get these ideas?"
  55.  
  56.  
  57. Volume-Number: Volume 30, Number 61
  58.  
  59.