summaryrefslogtreecommitdiff
path: root/2003/i/buspctl/src/grammar.y
blob: 0128947d408184815e4cb373827fd4b29e164d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%{
#include <serial.h>

#include <stdio.h>

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);
}