Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 14.34 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdarg.h>
  3. #include<conio.h>
  4. #include<stdlib.h>
  5. #include<string.h>
  6. #include<ctype.h>
  7.  
  8. typedef struct
  9. {
  10.     int cod;
  11.     int linie;
  12.     union
  13.     {
  14.         char text[50];
  15.         int vi;
  16.         double vr;
  17.     };
  18. } Atom;
  19.  
  20. Atom atomi[1000];
  21. int idxAtomi = 0;
  22. int nAtomi = 0;
  23. int linie = 1;
  24. char inbuf[10000];
  25. char *pch = inbuf;
  26. FILE *fisier = NULL;
  27.  
  28. enum {
  29.     ID, VAL_INT, VAL_REAL, VAL_STR, VAR, FUNCTION, IF, ELSE, WHILE, END, RETURN, INT, REAL, STR,
  30.     COLON, SEMICOLON, LPAR, RPAR, COMMA, OR, AND, NOT, EQUAL, NOTEQUAL, LESS, ASSIGN, ADD, SUB, MUL, DIV, FINISH
  31. };
  32.  
  33. void err(const char *fmt, ...){
  34.     va_list va;
  35.     va_start(va, fmt);
  36.     fprintf(stderr, "error: ");
  37.     vfprintf(stderr, fmt, va);
  38.     fputc('\n', stderr);
  39.     va_end(va);
  40.     exit(-1);
  41. }
  42.  
  43. void tkerr(char* m) {
  44.     printf("Eroare in linia %d, %s ",atomi[idxAtomi].linie, m);
  45.     _getch();
  46.     return(1);
  47. }
  48.  
  49. void addAtom(int codul)
  50. {
  51.     atomi[nAtomi].cod = codul;
  52.     atomi[nAtomi].linie = linie;
  53.     nAtomi++;
  54. }
  55.  
  56. int getNextTK()
  57. {
  58.     int s = 0;
  59.     char ch;
  60.     char buf[50];
  61.     int n = 0;
  62.     for (;;)
  63.     {
  64.         ch = *pch;
  65.         //printf("#%d %c (%d)\n",s,ch,ch);
  66.         switch (s)
  67.         {
  68.         case 0:
  69.             if (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t')
  70.             {
  71.                 if (ch == '\n')
  72.                     ++linie;
  73.                 ++pch;
  74.             }
  75.             else if (ch == ':')
  76.             {
  77.                 ++pch;
  78.                 s = 1;
  79.             }
  80.             else if (ch == ';')
  81.             {
  82.                 ++pch;
  83.                 s = 2;
  84.             }
  85.             else if (ch == '(')
  86.             {
  87.                 ++pch;
  88.                 s = 3;
  89.             }
  90.             else if (ch == ')')
  91.             {
  92.                 ++pch;
  93.                 s = 4;
  94.             }
  95.             else if (ch == ',')
  96.             {
  97.                 ++pch;
  98.                 s = 5;
  99.             }
  100.             else if (ch == '-')
  101.             {
  102.                 ++pch;
  103.                 s = 6;
  104.             }
  105.             else if (ch == '&')
  106.             {
  107.                 ++pch;
  108.                 s = 7;
  109.             }
  110.             else if (ch == '!')
  111.             {
  112.                 ++pch;
  113.                 s = 9;
  114.             }
  115.             else if (ch == '=')
  116.             {
  117.                 ++pch;
  118.                 s = 12;
  119.             }
  120.             else if (ch == '<')
  121.             {
  122.                 ++pch;
  123.                 s = 15;
  124.             }
  125.             else if (ch == '+')
  126.             {
  127.                 ++pch;
  128.                 s = 16;
  129.             }
  130.             else if (ch == '*')
  131.             {
  132.                 ++pch;
  133.                 s = 17;
  134.             }
  135.             else if (ch == '/')
  136.             {
  137.                 ++pch;
  138.                 s = 18;
  139.             }
  140.             else if (isalpha(ch) || ch == '_')
  141.             {
  142.                 buf[n++] = ch;
  143.                 ++pch;
  144.                 s = 19;
  145.             }
  146.             else if (isdigit(ch))
  147.             {
  148.                 buf[n++] = ch;
  149.                 ++pch;
  150.                 s = 21;
  151.             }
  152.             else if (ch == '\"')
  153.             {
  154.                 ++pch;
  155.                 s = 26;
  156.             }
  157.             else if (ch == '\0')
  158.             {
  159.                 ++pch;
  160.                 s = 28;
  161.             }
  162.             else if (ch == '#')
  163.             {
  164.                 ++pch;
  165.                 s = 29;
  166.             }
  167.             else if (ch == '|')
  168.             {
  169.                 ++pch;
  170.                 s = 30;
  171.             }
  172.             else
  173.                 err("Caracter necunoscut %s \n", ch);
  174.             break;
  175.         case 1:
  176.             addAtom(COLON);
  177.             return COLON;
  178.         case 2:
  179.             addAtom(SEMICOLON);
  180.             return SEMICOLON;
  181.         case 3:
  182.             addAtom(LPAR);
  183.             return LPAR;
  184.         case 4:
  185.             addAtom(RPAR);
  186.             return RPAR;
  187.         case 5:
  188.             addAtom(COMMA);
  189.             return COMMA;
  190.         case 6:
  191.             addAtom(SUB);
  192.             return SUB;
  193.         case 7:
  194.             if (ch == '&')
  195.                 s = 8;
  196.         case 8:
  197.             addAtom(AND);
  198.             return AND;
  199.         case 9:
  200.             if (ch == '!')
  201.             {
  202.                 ++pch;
  203.                 s = 10;
  204.             }
  205.             else
  206.                 s = 11;
  207.             break;
  208.         case 10:
  209.             addAtom(NOTEQUAL);
  210.             return NOTEQUAL;
  211.         case 11:
  212.             addAtom(NOT);
  213.             return NOT;
  214.         case 12:
  215.             if (ch == '=')
  216.             {
  217.                 ++pch;
  218.                 s = 13;
  219.             }
  220.             else
  221.                 s = 14;
  222.             break;
  223.         case 13:
  224.             addAtom(EQUAL);
  225.             return EQUAL;
  226.         case 14:
  227.             addAtom(ASSIGN);
  228.             return ASSIGN;
  229.         case 15:
  230.             addAtom(LESS);
  231.             return LESS;
  232.         case 16:
  233.             addAtom(ADD);
  234.             return ADD;
  235.         case 17:
  236.             addAtom(MUL);
  237.             return MUL;
  238.         case 18:
  239.             addAtom(DIV);
  240.             return DIV;
  241.         case 19:
  242.             if (isalnum(ch) || ch == '_')
  243.             {
  244.                 buf[n++] = ch;
  245.                 ++pch;
  246.             }
  247.             else
  248.                 s = 20;
  249.             break;
  250.         case 20:
  251.             buf[n] = '\0';
  252.             if (!strcmp(buf, "var"))
  253.             {
  254.                 addAtom(VAR);
  255.                 return VAR;
  256.             }
  257.             else if (!strcmp(buf, "function"))
  258.             {
  259.                 addAtom(FUNCTION);
  260.                 return FUNCTION;
  261.             }
  262.             else if (!strcmp(buf, "if"))
  263.             {
  264.                 addAtom(IF);
  265.                 return IF;
  266.             }
  267.             else if (!strcmp(buf, "else"))
  268.             {
  269.                 addAtom(ELSE);
  270.                 return ELSE;
  271.             }
  272.             else if (!strcmp(buf, "while"))
  273.             {
  274.                 addAtom(WHILE);
  275.                 return WHILE;
  276.             }
  277.             else if (!strcmp(buf, "end"))
  278.             {
  279.                 addAtom(END);
  280.                 return END;
  281.             }
  282.             else if (!strcmp(buf, "return"))
  283.             {
  284.                 addAtom(RETURN);
  285.                 return RETURN;
  286.             }
  287.             else if (!strcmp(buf, "int"))
  288.             {
  289.                 addAtom(INT);
  290.                 return INT;
  291.             }
  292.             else if (!strcmp(buf, "real"))
  293.             {
  294.                 addAtom(REAL);
  295.                 return REAL;
  296.             }
  297.             else if (!strcmp(buf, "str"))
  298.             {
  299.                 addAtom(STR);
  300.                 return STR;
  301.             }
  302.             else
  303.             {
  304.                 addAtom(ID);
  305.                 strcpy(atomi[nAtomi - 1].text, buf);
  306.                 return ID;
  307.             }
  308.             break;
  309.         case 21:
  310.             if (isdigit(ch))
  311.             {
  312.                 buf[n++] = ch;
  313.                 ++pch;
  314.             }
  315.             else if (ch == '.')
  316.             {
  317.                 buf[n++] = ch;
  318.                 ++pch;
  319.                 s = 23;
  320.             }
  321.             else
  322.                 s = 22;
  323.             break;
  324.         case 22:
  325.             addAtom(VAL_INT);
  326.             strcpy(atomi[nAtomi - 1].text, buf);
  327.             atomi[nAtomi - 1].vi = atoi(buf);
  328.             return VAL_INT;
  329.         case 23:
  330.             if (isdigit(ch))
  331.             {
  332.                 buf[n++] = ch;
  333.                 ++pch;
  334.                 s = 24;
  335.             }
  336.             break;
  337.         case 24:
  338.             if (isdigit(ch))
  339.             {
  340.                 ++pch;
  341.                 buf[n++] = ch;
  342.  
  343.             }
  344.             else
  345.                 s = 25;
  346.             break;
  347.         case 25:
  348.             addAtom(VAL_REAL);
  349.             strcpy(atomi[nAtomi - 1].text, buf);
  350.             atomi[nAtomi - 1].vr = atof(buf);
  351.             return VAL_REAL;
  352.         case 26:
  353.             if (ch != '\"')
  354.             {
  355.             ++pch;
  356.                 buf[n++] = ch;
  357.             }
  358.             else if (ch == '\"') {
  359.                 ++pch;
  360.                 s = 27;
  361.         }
  362.             break;
  363.         case 27:
  364.             buf[n] = 0;
  365.             addAtom(VAL_STR);
  366.             strcpy(atomi[nAtomi - 1].text, buf);
  367.             return VAL_STR;
  368.         case 28:
  369.             addAtom(FINISH);
  370.             return FINISH;
  371.         case 29:
  372.             if (ch != '\r'&&ch != '\n'&&ch != '\0')
  373.             {
  374.                 ++pch;
  375.             }
  376.             else
  377.                 s = 0;
  378.             break;
  379.         case 30:
  380.             if (ch == '|')
  381.                 s = 31;
  382.             break;
  383.         case 31:
  384.             addAtom(OR);
  385.             return OR;
  386.         default:
  387.             err("Stare necunoscuta %d \n", s);
  388.             break;
  389.         }
  390.     }
  391. }
  392.  
  393. char *Afisare(int c)
  394. {
  395.     if (c == 0)
  396.         return("ID");
  397.     else if (c == 1)
  398.         return("VAL_INT");
  399.     else if (c == 2)
  400.         return("VAL_REAL");
  401.     else if (c == 3)
  402.         return("VAL_STR");
  403.     else if (c == 4)
  404.         return("VAR");
  405.     else if (c == 5)
  406.         return("FUNCTION");
  407.     else if (c == 6)
  408.         return("IF");
  409.     else if (c == 7)
  410.         return("ELSE");
  411.     else if (c == 8)
  412.         return("WHILE");
  413.     else if (c == 9)
  414.         return("END");
  415.     else if (c == 10)
  416.         return("RETURN");
  417.     else if (c == 11)
  418.         return("INT");
  419.     else if (c == 12)
  420.         return("REAL");
  421.     else if (c == 13)
  422.         return("STR");
  423.     else if (c == 14)
  424.         return("COLON");
  425.     else if (c == 15)
  426.         return("SEMICOLON");
  427.     else if (c == 16)
  428.         return("LPAR");
  429.     else if (c == 17)
  430.         return("RPAR");
  431.     else if (c == 18)
  432.         return("COMMA");
  433.     else if (c == 19)
  434.         return("OR");
  435.     else if (c == 20)
  436.         return("AND");
  437.     else if (c == 21)
  438.         return("NOT");
  439.     else if (c == 22)
  440.         return("EQUAL");
  441.     else if (c == 23)
  442.         return("NOTEQUAL");
  443.     else if (c == 24)
  444.         return("LESS");
  445.     else if (c == 25)
  446.         return("ASSIGN");
  447.     else if (c == 26)
  448.         return("ADD");
  449.     else if (c == 27)
  450.         return("SUB");
  451.     else if (c == 28)
  452.         return("MUL");
  453.     else if (c == 29)
  454.         return("DIV");
  455.     else if (c == 30)
  456.         return("FINISH");
  457. }
  458. int consume(int cod)
  459. {
  460.     printf("%d: se consuma %s", atomi[idxAtomi].linie ,Afisare(cod));
  461.     if (atomi[idxAtomi].cod == cod) {
  462.         ++idxAtomi;
  463.         printf("=>> consumat\n");
  464.         return 1;
  465.     }
  466.     else {
  467.         printf("=>>altceva (%s)\n", Afisare(atomi[idxAtomi].cod));
  468.         return 0;
  469.  
  470.     }
  471. }
  472. int instr()
  473. {
  474.     if (expr()) {
  475.         if (consume(SEMICOLON)) {
  476.             return 1;
  477.         }
  478.         else tkerr("expresie neterminata de ;");
  479.     }
  480.     else if (consume(SEMICOLON)) {
  481.         return 1;
  482.     }
  483.     else if (consume(IF)) {
  484.         if (consume(LPAR)) {
  485.             if (expr()) {
  486.                 if (consume(RPAR)) {
  487.                     if (block()) {
  488.                         if (consume(ELSE)) {
  489.                             if (block()) {
  490.                                 if (consume(END)) {
  491.                                     return 1;
  492.                                 }
  493.                                 else tkerr("lipseste END dupa ramura ELSE");
  494.                             }
  495.                             else tkerr("lipseste blocul de instructiuni de pe ramura ELSE");
  496.                         }
  497.                         else if (consume(END)) {
  498.                             return 1;
  499.                         }
  500.                         else tkerr("lipseste END la finalul if");
  501.                     }
  502.                     else tkerr("lipseste blocul de instructiuni din if");
  503.                 }
  504.                 else tkerr("lipsa paranteza dreapta");
  505.             }
  506.             else tkerr("lipsa expresie in if");
  507.         }
  508.         else tkerr("lipsa paranteza stanga");
  509.     }
  510.     else if (consume(RETURN)) {
  511.         if (expr()) {
  512.             if (consume(SEMICOLON)) {
  513.                 return 1;
  514.             }
  515.             else tkerr("lipsa ;");
  516.         }
  517.         else tkerr("lipsa expresie");
  518.     }
  519.     else if (consume(WHILE)) {
  520.         if (consume(LPAR)) {
  521.             if (expr()) {
  522.                 if (consume(RPAR)) {
  523.                     if (block()) {
  524.                         if (consume(END)) {
  525.                             return 1;
  526.                         }
  527.                         else tkerr("lipsa END la finalul WHILE");
  528.                     }
  529.                     else tkerr("lipsa bloc din interiorul while");
  530.                 }
  531.                 else tkerr("lipsa paranteza dreapta la while");
  532.             }
  533.             else tkerr("lipsa expresie in while");
  534.         }
  535.         else tkerr("lipsa paranteza stanga la while");
  536.     }
  537.     else return 0;
  538. }
  539. int block()
  540. {
  541.     if (instr()) {
  542.         while (1) {
  543.             if (!instr()) {
  544.                 break;
  545.             }
  546.         }
  547.         return 1;
  548.     }
  549.     else return 0;
  550. }
  551. int factor()
  552. {
  553.     if (consume(VAL_INT)) {
  554.         return 1;
  555.     }
  556.     else if (consume(VAL_REAL)) {
  557.         return 1;
  558.     }
  559.     else if (consume(VAL_STR)) {
  560.         return 1;
  561.     }
  562.     else if (consume(LPAR)) {
  563.         if (expr()) {
  564.             if (consume(RPAR)) {
  565.                 return 1;
  566.             }
  567.             else tkerr("lipsa paranteza dreapta");
  568.         }
  569.         else tkerr("expresie gresita intre paranteze");
  570.     }
  571.     else {
  572.         if (consume(ID)) {
  573.             if (consume(LPAR)) {
  574.                 if (expr()) {
  575.                     while (1) {
  576.                         if (consume(COMMA)) {
  577.                             if (!expr())
  578.                                 tkerr("lipsa expresie dupa virgula");
  579.                         }
  580.                         else break;
  581.                     }
  582.                     if (consume(RPAR)) {
  583.                         return 1;
  584.                     }
  585.                     else tkerr("lipsa paranteza dreapta");
  586.                 }
  587.                 else if (consume(RPAR)) {
  588.                     return 1;
  589.                 }
  590.                 else tkerr("lipsa paranteza dreapta");
  591.             }
  592.             return 1;
  593.         }
  594.         return 0;
  595.     }
  596. }
  597. int exprPrefix()
  598. {
  599.     if (consume(SUB)) {
  600.         if (factor()) {
  601.             return 1;
  602.         }
  603.         else tkerr("lipsa factor dupa SUB");
  604.     }
  605.     else if (consume(NOT)) {
  606.         if (factor()) {
  607.             return 1;
  608.         }
  609.         else tkerr("lipsa factor dupa NOT");
  610.     }
  611.     else if (factor()) {
  612.         return 1;
  613.     }
  614.     return 0;
  615. }
  616. int exprMul()
  617. {
  618.     if (exprPrefix()) {
  619.         while (1) {
  620.             if (consume(MUL)) {
  621.                 if (exprPrefix()) {
  622.                     return 1;
  623.                 }
  624.                 else tkerr("lipsa exprPrefix dupa MUL");
  625.             }
  626.             else if (consume(DIV)) {
  627.                 if (exprPrefix()) {
  628.                     return 1;
  629.                 }
  630.                 else tkerr("lipsa exprPrefix dupa DIV");
  631.             }
  632.             else break;
  633.         }
  634.         return 1;
  635.     }
  636.     else return 0;
  637. }
  638. int exprAdd()
  639. {
  640.     if (exprMul()) {
  641.         while (1) {
  642.             if (consume(ADD)) {
  643.                 if (exprMul()) {
  644.                     return 1;
  645.                 }
  646.                 else tkerr("lipsa exprInmultire dupa ADD");
  647.             }
  648.             else if (consume(SUB)) {
  649.                 if (exprMul()) {
  650.                     return 1;
  651.                 }
  652.                 else tkerr("lipsa exprInmultire dupa SUB");
  653.             }
  654.             else break;
  655.         }
  656.         return 1;
  657.     }
  658.     else return 0;
  659. }
  660. int exprComp()
  661. {
  662.     if (exprAdd()) {
  663.         if (consume(LESS)) {
  664.             if (exprAdd()) {
  665.                 return 1;
  666.             }
  667.             else tkerr("lipsa exprAdunare dupa LESS");
  668.         }
  669.         else if (consume(EQUAL)) {
  670.             if (exprAdd()) {
  671.                 return 1;
  672.             }
  673.             else tkerr("lipsa exprAdunare dupa EQUAL");
  674.         }
  675.         return 1;
  676.     }
  677.     else return 0;
  678. }
  679. int exprAssing()
  680. {
  681.     if (consume(ID)) {
  682.         if (consume(ASSIGN)) {
  683.             if (exprComp()) {
  684.                 return 1;
  685.             }
  686.             else tkerr("lipsa exprComp dupa ASSIGN");
  687.         }
  688.         else {
  689.             idxAtomi--;
  690.             if (exprComp()) {
  691.                 return 1;
  692.             }
  693.             else return 0;
  694.         }
  695.     }
  696.     else {
  697.         if (exprComp()) {
  698.             return 1;
  699.         }
  700.         else return 0;
  701.     }
  702. }
  703. int exprLogic()
  704. {
  705.     if (exprAssing()) {
  706.         while (1) {
  707.             if (consume(AND)) {
  708.                 if (exprAssing()) {
  709.                     return 1;
  710.                 }
  711.                 else tkerr("lipseste exprAtribuire dupa AND");
  712.             }
  713.             else if (consume(OR)) {
  714.                 if (exprAssing()) {
  715.                     return 1;
  716.                 }
  717.                 else tkerr("lipseste exprAtribuire dupa OR");
  718.             }
  719.             else break;
  720.         }
  721.         return 1;
  722.     }
  723.     else return 0;
  724. }
  725. int expr()
  726. {
  727.     if (exprLogic()) {
  728.         return 1;
  729.     }
  730.     return 0;
  731. }
  732. int funcParam()
  733. {
  734.     if (consume(ID)) {
  735.         if (consume(COLON)) {
  736.             if (baseType())
  737.                 return 1;
  738.             else tkerr("lipseste tipul de baza");
  739.         }
  740.         else tkerr("lipseste :");
  741.     }
  742.     return 0;
  743. }
  744. int funcParams()
  745. {
  746.     if (funcParam()) {
  747.         while (1) {
  748.             if (consume(COMMA))
  749.             {
  750.                 if (funcParam())
  751.                     return 1;
  752.                 else tkerr("lipseste parametrul de dupa virgula");
  753.  
  754.             }
  755.  
  756.         }
  757.         return 1;
  758.     }
  759.     else return 1;
  760. }
  761. int baseType()
  762. {
  763.     if (consume(INT)) {
  764.         return 1;
  765.     }
  766.     else if (consume(REAL)) {
  767.         return 1;
  768.     }
  769.     else if (consume(STR)) {
  770.         return 1;
  771.     }
  772.     else return 0;
  773. }
  774. int defVar()
  775. {
  776.     if (consume(VAR)) {
  777.         if (consume(ID)) {
  778.             if (consume(COLON)) {
  779.                 if (baseType()) {
  780.                     if (consume(SEMICOLON)) {
  781.                         return 1;
  782.                     }
  783.                     else tkerr("lipseste ; dupa definitia variabile");
  784.                 }
  785.                 else tkerr("lipseste tipul variabile");
  786.             }
  787.             else tkerr("lipseste : dupa numele variabilei");
  788.         }
  789.         else tkerr("lipseste numele varaibilei");
  790.     }
  791.     return 0;
  792. }
  793. int defFunc()
  794. {
  795.     if (consume(FUNCTION)) {
  796.         if (consume(ID)) {
  797.             if (consume(LPAR)) {
  798.                 if (funcParams()) {
  799.                     if (consume(RPAR)) {
  800.                         if (consume(COLON)) {
  801.                             if (baseType()){
  802.                                 while (1) {
  803.                                     if (!defVar())
  804.                                         break;
  805.                                 }
  806.                                 if (block()) {
  807.                                     if (consume(END))
  808.                                         return 1;
  809.                                     else tkerr("lipseste END");
  810.                                 }
  811.                                 else tkerr("lipseste blocul cu instructiuni");
  812.                             }
  813.                             else tkerr("lipseste tipul de baza");
  814.                         }
  815.                         else tkerr("lipseste :");
  816.                     }
  817.                     else tkerr("lipseste )");
  818.                 }
  819.                 else tkerr("lipsesc parametrii functiei");
  820.             }
  821.             else tkerr("lipseste (");
  822.         }
  823.         else tkerr("lipseste numele functiei");
  824.     }
  825.     return 0;
  826. }
  827. int program()
  828. {
  829.     for (;;) {
  830.         if (defVar()) {
  831.  
  832.         }
  833.         else if (defFunc()) {
  834.  
  835.         }
  836.         else if (block()) {
  837.  
  838.         }
  839.         else break;
  840.     }
  841.     if (consume(FINISH))
  842.         return 1;
  843.     else {
  844.         tkerr("lipseste FINISH");
  845.         return 0;
  846.     }
  847. }
  848. int main()
  849. {
  850.     fisier = fopen("prog.q", "r");
  851.     if (fisier == NULL)
  852.         printf("eroare");
  853.     int m = fread(inbuf, 1, 20000, fisier);
  854.     inbuf[m] = '\0';
  855.     while (getNextTK() != FINISH)
  856.     {
  857.         printf("%d ", atomi[nAtomi - 1].linie);
  858.         if (atomi[nAtomi - 1].cod == 1)
  859.         {
  860.             printf("%s %d \n", Afisare(atomi[nAtomi - 1].cod), atomi[nAtomi - 1].vi);
  861.         }
  862.         else if (atomi[nAtomi - 1].cod == 2)
  863.         {
  864.             printf("%s %f \n", Afisare(atomi[nAtomi - 1].cod), atomi[nAtomi - 1].vr);
  865.         }
  866.         else
  867.         {
  868.             printf("%s %s \n", Afisare(atomi[nAtomi - 1].cod), atomi[nAtomi - 1].text);
  869.         }
  870.     }
  871.     if (program())
  872.         printf("Sintaxa OK\n");
  873.     else
  874.         err("Eroare\n");
  875.     fclose(fisier);
  876.     _getch();
  877.     return 0;
  878. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement