%{ #include #include void yyerror (const char *s); int yylex (void); %} %defines %token NUM WRITE READ ERR %% input: READ NUM { printf ("read %d = %d\n", $2, serial_busp_read ($2)); } | WRITE NUM NUM { printf ("write %d %d\n", $2, $3); serial_busp_write ($2, $3); } ; %% void yyerror (const char *s) { fprintf (stderr, "buspctl: %s\n", s); }