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

31
def.yy
View File

@@ -1,17 +1,14 @@
%{
#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;
%}
%union {
@@ -48,7 +45,7 @@ statement
variable_declaration
: LET ID COLON INT_TYPE '=' expression SEMICOLON
{ printf("Deklaracja zmiennej: %s\n", $2); free($2); }
{ printf("Deklaracja zmiennej: %s\n", $2); }
;
expression
@@ -58,21 +55,11 @@ expression
| expression '/' expression { printf("Wyrazenie z /\n"); }
| '(' expression ')' { printf("Wyrazenie w nawiasach\n"); }
| INT_LIT { printf("Literal calkowity: %d\n", $1); }
| ID { printf("Identyfikator: %s\n", $1); free($1); }
| ID { printf("Identyfikator: %s\n", $1); }
;
%%
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;