pop_push.awk 704 B

1234567891011121314151617181920212223242526272829
  1. BEGIN { print "#include \"pop_push.h\""
  2. print
  3. print "char *pop_push[] = {"
  4. print "\"\","
  5. switch = 0
  6. }
  7. /aar/ { switch = NR }
  8. { if (switch) {
  9. if ($1 == "cal" || $1 == "cai") $3 = "-?"
  10. printf("/* %s */ \"%s\",\n",$1,$3)
  11. col_2[NR-switch] = $2
  12. comment[NR-switch] = $1
  13. }
  14. }
  15. END { print "};"
  16. print
  17. print "char flow_tab[]= {"
  18. print "'\\000',"
  19. for(i=0; i < NR-switch; i++) {
  20. inf = col_2[i]
  21. f_out = "/* " comment[i] " */ "
  22. if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|"
  23. if (substr(inf,2,1)=="c") f_out = f_out "CONDBRA"
  24. else if (substr(inf,2,1)=="t") f_out = f_out "JUMP"
  25. else f_out = f_out "'\\000'"
  26. print f_out","
  27. }
  28. print "};"
  29. }