~crm/uni

049691a223a32b264e9eb34d08d1b4d4bdb81d04 — Christos Margiolis 2 months ago b8350fe
done
A lex_yacc_compilers/part3/02_B1_PART_B2.pdf => lex_yacc_compilers/part3/02_B1_PART_B2.pdf +0 -0
M lex_yacc_compilers/part3/lex.l => lex_yacc_compilers/part3/lex.l +17 -14
@@ 2,6 2,9 @@
%{
#include <stdlib.h>
#include "syntax.tab.h"

int	cw = 0;	/* correct words */
int	ww = 0;	/* wrong words */
%}

/*


@@ 22,24 25,24 @@ COMMENT		;.*
 * οποίο ανήκει
 */
%%
"deffacts"	{ return DEFFACTS; }
"defrule"	{ return DEFRULE; }
"bind"		{ return BIND; }
"read"		{ return READ; }
"printout"	{ return PRINT; }
"test"		{ return TEST; }
"="		{ return COMP; }
"deffacts"	{ cw++;  return DEFFACTS; }
"defrule"	{ cw++;  return DEFRULE; }
"bind"		{ cw++;  return BIND; }
"read"		{ cw++;  return READ; }
"printout"	{ cw++;  return PRINT; }
"test"		{ cw++;  return TEST; }
"="		{ cw++;  return COMP; }
"("		{ return LPAR; }
")"		{ return RPAR; }
"->"		{ return ARROW; }
{ARITH}		{ return ARITH; }
{INT}		{ return INT; }
{FLOAT}		{ return FLOAT;}
{STR}		{ return STR; }
{DEFIN}		{ return DEFIN; }
{VAR}		{ return VAR; }
{ARITH}		{ cw++;  return ARITH; }
{INT}		{ cw++;  return INT; }
{FLOAT}		{ cw++;  return FLOAT;}
{STR}		{ cw++;  return STR; }
{DEFIN}		{ cw++; return DEFIN; }
{VAR}		{ cw++; return VAR; }
{DELIM}		{ /* ignore whitespace */ }
{COMMENT}	{ /* skip comments */ }
"\n"		{ return NEWLINE; }
.		{ return UNKNOWN; }
.		{ ww++; return UNKNOWN; }
%%

M lex_yacc_compilers/part3/output.txt => lex_yacc_compilers/part3/output.txt +1 -1
@@ 1,6 1,6 @@
input.txt: success

correct words: 0
correct words: 38
correct expressions: 12
wrong words: 0
wrong expressions: 0

M lex_yacc_compilers/part3/syntax.y => lex_yacc_compilers/part3/syntax.y +4 -4
@@ 9,10 9,10 @@ extern int	yylex(void);
/* Input and output files. */
extern FILE	*yyin, *yyout;

int	cw = 0;	/* correct words */
int	ce = 0;	/* correct expressions */
int	ww = 0;	/* wrong words */
int	we = 0;	/* wrong expressions */
extern int	cw;	/* correct words */
extern int	ww;	/* wrong words */
int		ce = 0;	/* correct expressions */
int		we = 0;	/* wrong expressions */

void	yyerror(const char *);
%}