home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Bug_Fixes / Net.v7bugs / 0099 < prev    next >
Encoding:
Text File  |  1982-04-20  |  1.0 KB  |  88 lines

  1. Autzoo.1588
  2. net.bugs.v7
  3. utzoo!henry
  4. Tue Apr 20 19:51:59 1982
  5. yacc library
  6. The V7 distribution does not include the -ly library at all.  This is
  7. not serious since it can be built from the description in the manual.
  8. I also added a default yylex to ours.  The following are the sources,
  9. the makefile, and a simple test program.
  10.  
  11. --- main.c ---
  12. main()
  13. {
  14.     return(yyparse());
  15. }
  16. --- yyerror.c ---
  17. #include <stdio.h>
  18.  
  19. yyerror(s)
  20. char *s;
  21. {
  22.     fprintf(stderr, "%s\n", s);
  23. }
  24. --- yylex.c ---
  25. #include <stdio.h>
  26.  
  27. int
  28. yylex()
  29. {
  30.     return(getchar());
  31. }
  32. --- Makefile ---
  33. CFLAGS=-O
  34.  
  35. all:    liby.a
  36.  
  37. cp:    liby.a
  38.     cp liby.a /usr/lib/liby.a
  39.  
  40. liby.a:    main.o yyerror.o yylex.o
  41.     ar cr liby.a main.o yyerror.o yylex.o
  42.  
  43. clean:
  44.     rm -f liby.a *.o test
  45.  
  46. test:    test.o liby.a
  47.     $(CC) -n test.o liby.a -o test
  48. --- test.y ---
  49. %%
  50. all:
  51.     word
  52.     |
  53.     all space word
  54.     ;
  55.  
  56. word:
  57.     if
  58.     |
  59.     but
  60.     |
  61.     maybe
  62.     ;
  63.  
  64. if:
  65.     'i' 'f' {
  66.         printf("if\n");
  67.     }
  68.  
  69. but:
  70.     'b' 'u' 't' {
  71.         printf("but\n");
  72.     }
  73.  
  74. maybe:
  75.     'm' 'a' 'y' 'b' 'e' {
  76.         printf("maybe\n");
  77.     }
  78.  
  79. space:    aspace
  80.     |
  81.     space aspace
  82.     ;
  83.  
  84. aspace:    ' '
  85.     |
  86.     '\n'
  87.     ;
  88.