Revert "Add c++ support"

This reverts commit 5762271fd0.
This commit is contained in:
2025-12-04 22:30:44 +01:00
parent 5762271fd0
commit eb527222b0
8 changed files with 99 additions and 130 deletions

View File

@@ -88,19 +88,16 @@
/* Copy the first part of user declarations. */
#line 1 "def.yy"
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <FlexLexer.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define INFILE_ERROR 1
#define OUTFILE_ERROR 2
extern yyFlexLexer lexer;
void yyerror(const char *s);
int yylex();
extern int yylex(void);
extern void yyerror(const char *s);
extern int yylineno;
extern FILE *yyin;
/* Enabling traces. */
@@ -123,13 +120,13 @@ int yylex();
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 17 "def.yy"
#line 14 "def.yy"
{
char *text;
int ival;
}
/* Line 193 of yacc.c. */
#line 133 "def.tab.cc"
#line 130 "def.tab.cc"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -142,7 +139,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
#line 146 "def.tab.cc"
#line 143 "def.tab.cc"
#ifdef short
# undef short
@@ -429,8 +426,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 36, 36, 40, 41, 45, 46, 50, 55, 56,
57, 58, 59, 60, 61
0, 33, 33, 37, 38, 42, 43, 47, 52, 53,
54, 55, 56, 57, 58
};
#endif
@@ -1344,63 +1341,63 @@ yyreduce:
switch (yyn)
{
case 2:
#line 36 "def.yy"
#line 33 "def.yy"
{ printf("koniec\n"); ;}
break;
case 5:
#line 45 "def.yy"
#line 42 "def.yy"
{ printf("Deklaracja zmiennej\n"); ;}
break;
case 6:
#line 46 "def.yy"
#line 43 "def.yy"
{ printf("instrukcja\n"); ;}
break;
case 7:
#line 51 "def.yy"
{ printf("Deklaracja zmiennej: %s\n", (yyvsp[(2) - (7)].text)); free((yyvsp[(2) - (7)].text)); ;}
#line 48 "def.yy"
{ printf("Deklaracja zmiennej: %s\n", (yyvsp[(2) - (7)].text)); ;}
break;
case 8:
#line 55 "def.yy"
#line 52 "def.yy"
{ printf("Wyrazenie z +\n"); ;}
break;
case 9:
#line 56 "def.yy"
#line 53 "def.yy"
{ printf("Wyrazenie z -\n"); ;}
break;
case 10:
#line 57 "def.yy"
#line 54 "def.yy"
{ printf("Wyrazenie z *\n"); ;}
break;
case 11:
#line 58 "def.yy"
#line 55 "def.yy"
{ printf("Wyrazenie z /\n"); ;}
break;
case 12:
#line 59 "def.yy"
#line 56 "def.yy"
{ printf("Wyrazenie w nawiasach\n"); ;}
break;
case 13:
#line 60 "def.yy"
#line 57 "def.yy"
{ printf("Literal calkowity: %d\n", (yyvsp[(1) - (1)].ival)); ;}
break;
case 14:
#line 61 "def.yy"
{ printf("Identyfikator: %s\n", (yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text)); ;}
#line 58 "def.yy"
{ printf("Identyfikator: %s\n", (yyvsp[(1) - (1)].text)); ;}
break;
/* Line 1267 of yacc.c. */
#line 1404 "def.tab.cc"
#line 1401 "def.tab.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1614,19 +1611,9 @@ yyreturn:
}
#line 64 "def.yy"
#line 61 "def.yy"
yyFlexLexer lexer;
int yylex() {
return lexer.yylex();
}
void yyerror(const char *s) {
fprintf(stderr, "Blad: %s w linii %d\n", s, lexer.lineno());
}
int main(int argc, char *argv[]) {
yyparse();
return 0;