Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*(Y-A) слова, глас-е в алф-м порядке. BL.y*/
- %{
- #include <stdio.h>
- %}
- %token SOGL
- %%
- s: { printf("Enter the line\n"); }
- | s q5 '\n' { printf("Correct\n"); }
- | s q4 '\n' { printf("Correct\n"); }
- | s q3 '\n' { printf("Correct\n"); }
- | s q2 '\n' { printf("Correct\n"); }
- | s q1 '\n' { printf("Correct\n"); }
- | s error '\n' { yyerrok; }
- ;
- q5: 'u'
- | SOGL
- | q5 'u'
- | q5 SOGL
- | q4 'u'
- | q3 'u'
- | q2 'u'
- | q1 'u'
- ;
- q4: 'o'
- | SOGL
- | q4 'o'
- | q4 SOGL
- | q3 'o'
- | q2 'o'
- | q1 'o'
- ;
- q3: 'i'
- | SOGL
- | q3 'i'
- | q3 SOGL
- | q2 'i'
- | q1 'i'
- ;
- q2: 'e'
- | SOGL
- | q2 'e'
- | q2 SOGL
- | q1 'e'
- ;
- q1: 'a'
- | SOGL
- | q1 'a'
- | q1 SOGL
- %%
- main(){ return(yyparse()); }
- yylex(){
- int c = getchar();
- if (c=='q' | c=='w' | c=='r' | c=='t' | c=='y' | c=='p' | c=='s' | c=='d'| c=='f' | c=='g' | c=='h' | c=='j' |
- c=='k' | c=='l' | c=='z' | c=='x' | c=='c' | c=='v' | c=='b' | c=='n' | c=='m')
- return(SOGL);return c;
- }
- yyerror(const char* s){ fprintf(stderr, "%s\n",s); }
- yywrap(){ return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement