Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 47 lines (38 sloc) 0.66 kb
c4acbea Toru Yamaguchi add example4
authored
1 %{
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 %}
6
7 %token NUMBER TOKHEAT STATE TOKTARGET TOKTEMPERATURE
8
9 %%
10 commands: /* empty */
11 | commands command
12 ;
13
14 command:
15 heat_switch
16 |
17 target_set
18 ;
19
20 heat_switch:
21 TOKHEAT STATE
22 {
23 printf("\tHeat turned on or off\n");
24 }
25 ;
26
27 target_set:
28 TOKTARGET TOKTEMPERATURE NUMBER
29 {
30 printf("\tTemperature set\n");
31 }
32 ;
33 %%
34
35 void yyerror(const char *str) {
36 fprintf(stderr,"error: %s\n",str);
37 }
38
39 int yywrap() {
40 return 1;
41 }
42
43 int main(void) {
44 yyparse();
45 exit(0);
46 }
Something went wrong with that request. Please try again.