logoISU  

CS456 - Systems Programming

Spring 2025

Displaying ./code/lexyacc/example4.l

/*

Compile with :
> lex example4.l
> yacc -d example4.y
> gcc lex.yy.c y.tab.c -o example4 -lfl

*/

%{
#include <stdio.h>
#include "y.tab.h"
%}
%%
[0-9]+                  return NUMBER;
heat                    return TOKHEAT;
on|off                  return STATE;
target                  return TOKTARGET;
temperature             return TOKTEMPERATURE;
\n                      /* ignore end of line */;
[ \t]+                  /* ignore whitespace */;
%%