All pastes #39029 Raw Edit

Someone

public text v1 · immutable
#39029 ·published 2006-01-29 16:54 UTC
rendered paste body
%{
    #include <stdlib.h>
    void yyerror(char *);
    #include "y.tab.h"
    extern int yylval; 
%}
id [a-z]

%%

{id}     {
                yylval = *yytext - 'a';
                return VARIABLE;
            }
[0-9]+      {
                yylval = atoi(yytext); 
  		return INTEGER;
	    }
[-+()=/*\n] { return *yytext; }
    /* skip whitespace */
[ \t]        ;
    /* anything else is an error */
.               yyerror("invalid character");
%%
int yywrap(void) {
    return 1;
}