diff --git a/source/eaxhla.l b/source/eaxhla.l index fce35dd..dc14ac9 100644 --- a/source/eaxhla.l +++ b/source/eaxhla.l @@ -6,6 +6,7 @@ identifier [A-z_][A-z0-9_]* wsnl [ \t\r\v\f\n] +%option yylineno %% program{wsnl}+{identifier}{wsnl}+begin{wsnl}+ { return PROGRAM_HEAD; } diff --git a/source/eaxhla.y b/source/eaxhla.y index e76ed52..8612fbf 100644 --- a/source/eaxhla.y +++ b/source/eaxhla.y @@ -4,7 +4,10 @@ #include "eaxhla.yy.h" #include "assembler.h" - void yyerror() { ; } + void yyerror() { + printf("\033[31mError: syntax error at line %d.\033[0m\n", yylineno); + } + %} %union{