This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include <stdio.h> | |
%} | |
%% | |
^00.* { printf("Accepted: %s\n", yytext); } | |
.*01$ { printf("Accepted: %s\n", yytext); } | |
.* { printf("Rejected: %s\n", yytext); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "y.tab.h" | |
extern int yylval; | |
%} | |
%% | |
[0-9]+ { yylval = atoi(yytext); return NUMBER; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
int k=0,z=0,i=0,j=0,c=0; | |
char a[16],ac[20],stk[15],act[10]; | |
void check(); | |
int main() | |
{ | |
puts("GRAMMAR is E->E+E \n E->E*E \n E->(E) \n E->id"); | |
puts("enter input string "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
char input[10]; | |
int i=0,error=0; | |
void E(); | |
void T(); | |
void Eprime(); | |
void Tprime(); | |
void F(); | |
void main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#define MAX_STATES 100 | |
#define MAX_SYMBOLS 10 | |
int n_states, n_symbols; | |
int dfa[MAX_STATES][MAX_SYMBOLS]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
char tac[100][100]; | |
int n; | |
void generate8086(char *line) { | |
char lhs[10], op1[10], op2[10], oper; |