File: yacc2grammar.awk

package info (click to toggle)
fim 0.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,048 kB
  • sloc: cpp: 32,769; ansic: 4,507; makefile: 1,549; sh: 1,502; perl: 189; exp: 28; awk: 9
file content (10 lines) | stat: -rwxr-xr-x 274 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/awk -f
#
# This program prints out the Grammar section of a yacc.output file. 
#
BEGIN { sp=0 }
/program:/ { sp=sp+1; }
/^Grammar/ { sp=sp+1; }
/^Terminals/ { sp=sp+1; }
#/.*/ { if(sp==3){  print; } }
/.*/ { if(sp==3){ gsub("^[ \t]*[0-9][0-9]*","\t"); print; } }