003 File Manager
Current Path:
/usr/src/contrib/byacc/test
usr
/
src
/
contrib
/
byacc
/
test
/
📁
..
📄
README
(142 B)
📁
btyacc
📄
btyacc_calc1.y
(4.42 KB)
📄
btyacc_demo.y
(6.55 KB)
📄
btyacc_destroy1.y
(1.56 KB)
📄
btyacc_destroy2.y
(1.56 KB)
📄
btyacc_destroy3.y
(1.56 KB)
📄
calc.y
(1.84 KB)
📄
calc1.y
(4.22 KB)
📄
calc2.y
(2.31 KB)
📄
calc3.y
(2.37 KB)
📄
calc_code_all.y
(2.07 KB)
📄
calc_code_default.y
(1.92 KB)
📄
calc_code_imports.y
(1.92 KB)
📄
calc_code_provides.y
(1.92 KB)
📄
calc_code_requires.y
(1.92 KB)
📄
calc_code_top.y
(1.91 KB)
📄
code_calc.y
(1.92 KB)
📄
code_debug.y
(341 B)
📄
code_error.y
(341 B)
📄
empty.y
(290 B)
📄
err_inherit1.y
(1.09 KB)
📄
err_inherit2.y
(1.39 KB)
📄
err_inherit3.y
(1.38 KB)
📄
err_inherit4.y
(1.41 KB)
📄
err_inherit5.y
(1.37 KB)
📄
err_syntax1.y
(272 B)
📄
err_syntax10.y
(323 B)
📄
err_syntax11.y
(292 B)
📄
err_syntax12.y
(303 B)
📄
err_syntax13.y
(299 B)
📄
err_syntax14.y
(296 B)
📄
err_syntax15.y
(286 B)
📄
err_syntax16.y
(330 B)
📄
err_syntax17.y
(273 B)
📄
err_syntax18.y
(319 B)
📄
err_syntax19.y
(324 B)
📄
err_syntax2.y
(272 B)
📄
err_syntax20.y
(347 B)
📄
err_syntax21.y
(355 B)
📄
err_syntax22.y
(410 B)
📄
err_syntax23.y
(418 B)
📄
err_syntax24.y
(415 B)
📄
err_syntax25.y
(454 B)
📄
err_syntax26.y
(71 B)
📄
err_syntax27.y
(2.36 KB)
📄
err_syntax3.y
(296 B)
📄
err_syntax4.y
(268 B)
📄
err_syntax5.y
(301 B)
📄
err_syntax6.y
(296 B)
📄
err_syntax7.y
(292 B)
📄
err_syntax7a.y
(293 B)
📄
err_syntax7b.y
(291 B)
📄
err_syntax8.y
(287 B)
📄
err_syntax8a.y
(291 B)
📄
err_syntax9.y
(307 B)
📄
error.y
(269 B)
📄
expr.oxout.y
(29.75 KB)
📄
grammar.y
(26.98 KB)
📄
inherit0.y
(797 B)
📄
inherit1.y
(1.38 KB)
📄
inherit2.y
(1.37 KB)
📄
ok_syntax1.y
(2.92 KB)
📄
pure_calc.y
(2.03 KB)
📄
pure_error.y
(496 B)
📄
quote_calc.y
(1.97 KB)
📄
quote_calc2.y
(1.97 KB)
📄
quote_calc3.y
(2.03 KB)
📄
quote_calc4.y
(2.08 KB)
📄
run_lint.sh
(509 B)
📄
run_make.sh
(3.58 KB)
📄
run_test.sh
(5.9 KB)
📄
varsyntax_calc1.y
(4.48 KB)
📁
yacc
Editing: inherit1.y
%{ #include <stdlib.h> typedef enum {cGLOBAL, cLOCAL} class; typedef enum {tREAL, tINTEGER} type; typedef char * name; struct symbol { class c; type t; name id; }; typedef struct symbol symbol; struct namelist { symbol *s; struct namelist *next; }; typedef struct namelist namelist; extern symbol *mksymbol(type t, class c, name id); #ifdef YYBISON #define YYLEX_DECL() yylex(void) #define YYERROR_DECL() yyerror(const char *s) extern int YYLEX_DECL(); extern void YYERROR_DECL(); #endif %} %token <cval> GLOBAL LOCAL %token <tval> REAL INTEGER %token <id> NAME %type <nlist> declaration namelist locnamelist %type <cval> class %type <tval> type %union { class cval; type tval; namelist * nlist; name id; } %start declaration %% declaration: class type namelist { $$ = $3; } | type locnamelist { $$ = $2; } ; class : GLOBAL { $$ = cGLOBAL; } | LOCAL { $$ = cLOCAL; } ; type : REAL { $$ = tREAL; } | INTEGER { $$ = tINTEGER; } ; namelist: namelist NAME { $$->s = mksymbol($<tval>0, $<cval>-1, $2); $$->next = $1; } | NAME { $$->s = mksymbol($<tval>0, $<cval>-1, $1); $$->next = NULL; } ; locnamelist: { $<cval>$ = cLOCAL; } /* set up semantic stack for <class> = LOCAL */ { $<tval>$ = $<tval>-1; } /* copy <type> to where <namelist> expects it */ namelist { $$ = $3; } ; %% extern int YYLEX_DECL(); extern void YYERROR_DECL();
Upload File
Create Folder