We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 281f764 commit ea966c7Copy full SHA for ea966c7
2.c
@@ -0,0 +1,32 @@
1
+****LEX PART****
2
+%{
3
+#include "y.tab.h"
4
+%}
5
+%%
6
+a {return A;}
7
+b {return B;}
8
+. {printf("unsuccesful");exit(0);}
9
+[\n] return '\n';
10
11
+****YACC PART****
12
13
+#include<stdio.h>
14
+#include<stdlib.h>
15
16
+%token A B
17
18
+input:s'\n'{printf("successful grammar\n");exit (0);}
19
+s: A s1 B | B
20
+s1:;|A s1
21
22
+yywrap(){}
23
+main()
24
+{
25
+ printf(" Enter a string\n");
26
+ yyparse();
27
+}
28
+int yyerror()
29
30
+ printf("Error\n");
31
+ exit(0);
32
0 commit comments