/* Asset Package Compiler */ %{ #include #include #include #include "sprite.h" #include "symbol.h" #include extern int lexer_init(); extern int lexer(); #define yylex lexer void yyerror(); %} %define parse.error verbose %define lr.type ielr %define api.value.type union %token NUM %token WORD //operators %token PROTOCLASS //+ %token SIBS //| %token FNAME //! //nonterminal types %type fd %type fdlist /* %token EXT */ /* %token FW */ /* %token SPR */ /* %token CC */ /* /\* Rules *\/ */ /* %% */ /* SS: SPR '/' MD '.' EXT */ /* MD: CC '_' FW */ /* | FW */ /* | CC */ /* Rules */ %% object_defs: %empty | arch_id object_defs ; arch_id: archetype | arch_id_ref ; arch_id_list: arch_id | arch_id arch_id_list ; archetype: PROTOCLASS label arch_id_list SIBS arch_id_list | PROTOCLASS label arch_id_list | label arch_id_ref vdat ; label: WORD ; arch_id_ref: NUM ; vdat: spritesheet ; spritesheet: fdlist ; fdlist: fd | fd fdlist ; fd: FNAME WORD | NUM; %% int main(int argc, char** argv) { /* Parse cmd line arguments */ lexer_init(); yyparse(); /* runs handle_fname for each filename */ return 0; } void yyerror (char const *s) { fprintf(stderr, "%s\n", s); }