Skip to content

Instantly share code, notes, and snippets.

@justjkk
Created June 13, 2010 15:15
Show Gist options
  • Save justjkk/436736 to your computer and use it in GitHub Desktop.
Save justjkk/436736 to your computer and use it in GitHub Desktop.
%{
#include<stdio.h>
//#include<string.h>
//#define YYSTYPE char *
#define yyerror(X) printf(X)
%}
%%
START: A 'c' B {printf("AND");}
;
A: 'a' {printf("alpha");}
;
B: 'b' {printf("beta");}
;
%%
int main()
{
printf("\n");
yyparse();
return 0;
}
int yywrap()
{
return 1;
}
int yylex()
{
return getchar();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment