Skip to content

Instantly share code, notes, and snippets.

@utkarshsingh99
Created November 26, 2019 16:10
Show Gist options
  • Save utkarshsingh99/27062744805ad84a0e67157896e546de to your computer and use it in GitHub Desktop.
Save utkarshsingh99/27062744805ad84a0e67157896e546de to your computer and use it in GitHub Desktop.
%{
/* Definition Section */
/* You define certain variables in here which you might need to manipulate your code */
%}
%%
/* Rules Section */
/* Pattern Actions begin */
/* This is a section where you define certain patterns of string (just like RegEx) */
/* Here's an example to identify digits: */
[0-9] {
printf("Here, I found a number! It's %s\n", yytext);
}
%%
/* Finally the code section begins */
int main() {
yylex();
/* Just a C Program function. You can do anything here */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment