LLgen.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #ifndef LLGEN_H
  2. #define LLGEN_H
  3. /* alloc.c */
  4. p_mem alloc(unsigned size);
  5. p_mem ralloc(p_mem p, unsigned size);
  6. p_mem new_mem(p_info p);
  7. /* check.c */
  8. void conflchecks(void);
  9. void prline(char *s);
  10. void printset(p_set p, char * s);
  11. int check(p_gram p);
  12. void moreverbose(p_set t);
  13. void prrule(p_gram p);
  14. void cfcheck(p_set s1, p_set s2, int flag);
  15. void resolve(p_gram p);
  16. void propagate(p_set set, p_gram p);
  17. void spaces(void);
  18. /* compute.c */
  19. typedef struct lngth {
  20. /* Structure used to compute the shortest possible
  21. * length of a terminal production of a rule.
  22. * In case of a tie, the second field is used.
  23. */
  24. int cnt;
  25. int val;
  26. } t_length, *p_length;
  27. void do_compute(void);
  28. int empty(p_gram p);
  29. int t_safety(int rep, int count, int persistent, int safety);
  30. int t_after(int rep, int count, int outsafety);
  31. /* gencode.c */
  32. void doclose(FILE *f);
  33. int *mk_tokenlist(void);
  34. void genhdr(void);
  35. void gencode(int argc);
  36. void opentemp(char * str);
  37. void geninclude(void);
  38. void genrecovery(void);
  39. void generate(p_file f);
  40. void prset(p_set p);
  41. void macro(char * s, p_nont n);
  42. void controlline(void);
  43. void getparams(void);
  44. void genprototypes(p_file f);
  45. void getansiparams(int mkdef);
  46. int gettok(void);
  47. void rulecode(p_gram p, int safety, int mustscan, int mustpop);
  48. void alternation(p_gram pp, int safety, int mustscan, int mustpop, int lb);
  49. void genncrecovery(void);
  50. int *dopush(p_gram p, int safety, int toplevel, int **pp);
  51. void getaction(int flag);
  52. int codeforterm(p_term q, int safety, int toplevel);
  53. void genswhead(p_term q, int rep_kind, int rep_count, int safety, int ispushed);
  54. void gencases(int *tokenlist, int caseno, int compacted);
  55. char * genname(char * s);
  56. void genpush(int d);
  57. void genincrdecr(char * s, int d);
  58. void genpop(int d);
  59. int analyze_switch(int *tokenlist);
  60. void add_cases(p_set s, int *tokenlist, int caseno);
  61. void out_list(int *tokenlist, int listno, int casecnt);
  62. void genextname(int d, char *s, FILE *f);
  63. void correct_prefix(void);
  64. /* LLgen.c */
  65. void newnorder(int index);
  66. void newtorder(int index);
  67. void p_init(void);
  68. void LL0_spec(void);
  69. void mkalt(p_gram prod, int condition, int lc, p_gram res);
  70. void mkterm(p_gram prod, int flags, int lc, p_gram result);
  71. p_gram copyrule(p_gram p, int length);
  72. /* Lpars.c */
  73. void LLparse(void);
  74. void LLscan(int t);
  75. void LLread(void);
  76. void LLerror(int t);
  77. void LLsafeerror(int t);
  78. int LLnext(int n);
  79. int LLskip(void);
  80. void LLnewlevel(unsigned int *LLsinfo);
  81. void LLoldlevel(unsigned int *LLsinfo);
  82. /* machdep.c */
  83. void UNLINK(char * x);
  84. void RENAME(char * x, char * y);
  85. char * libpath(char * s);
  86. /* main.c */
  87. int main(int argc, char *argv[]);
  88. void readgrammar(int argc, char *argv[]);
  89. void doparse(p_file p);
  90. void error(int lineno, char *s, char *t, char *u);
  91. void warning(int lineno, char *s, char *t, char *u);
  92. void fatal(int lineno, char *s, char *t, char *u);
  93. void comfatal(void);
  94. void copyfile(char *file);
  95. void install(char *target, char *source);
  96. /* name.c */
  97. void name_init(void);
  98. p_entry newentry(char * str, p_entry next);
  99. char * store(char * s);
  100. int hash(char * str);
  101. p_gram search(int type, char * str, int option);
  102. /* reach.c */
  103. void co_reach(void);
  104. void reachable(p_nont p);
  105. void reachwalk(p_gram p);
  106. /* sets.c */
  107. void setinit(int nt_needed);
  108. p_set get_set(void);
  109. p_set setalloc(void);
  110. int setunion(p_set a, p_set b);
  111. int setintersect(p_set a, p_set b);
  112. void setminus(p_set a, p_set b);
  113. int setempty(p_set p);
  114. int findindex(p_set set);
  115. int setcount(p_set set, int *saved);
  116. /* tokens.c */
  117. void copyact(char ch1, char ch2, int flag, int level);
  118. int scanner(void);
  119. int input(void);
  120. void unput(int c);
  121. void skipcomment(int flag);
  122. char * vallookup(int s);
  123. char * cpy(int s, char * p, int inserted);
  124. void LLmessage(int d);
  125. /* grammar.c */
  126. void save_grammar(FILE *f);
  127. #endif /* LLGEN_H */