minor fixes

This commit is contained in:
Simon 2024-07-19 00:22:38 +02:00
parent a52fd95965
commit f0622cbb3f
4 changed files with 8 additions and 10 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
build/ build/
.cache/

View File

@ -26,17 +26,13 @@
// boilerplate for this small example. Bummer. // boilerplate for this small example. Bummer.
%} %}
%option nodefault %option nodefault noyywrap noyylineno c++ yyclass="Lexer" prefix="stela_"
%option noyywrap
%option c++
%option yyclass="Lexer"
%option prefix="stela_"
%% %%
[a-z]+ { [a-z]+ {
std::cout << "Scanner: identifier [" << yytext << "]\n"; std::cout << "Scanner: identifier [" << yytext << "]\n";
return stela::Parser::make_STRING(yytext, stela::location( /* put location data here if you want */ )); return stela::Parser::make_STRING(yytext, stela::location());
} }
\( { \( {

View File

@ -1,7 +1,7 @@
#include <iostream> #include "interpreter.hpp"
#include "lexer.hpp" #include "lexer.hpp"
#include "parser.hpp" #include "parser.hpp"
#include "interpreter.hpp" #include <iostream>
int main() int main()
{ {
@ -10,4 +10,3 @@ int main()
std::cout << "Prase completed with result: " << result << '\n'; std::cout << "Prase completed with result: " << result << '\n';
return result; return result;
} }

View File

@ -1,5 +1,6 @@
%skeleton "lalr1.cc" %skeleton "lalr1.cc"
%require "3.8" %require "3.8.2"
%defines %defines
%define api.parser.class { Parser } %define api.parser.class { Parser }
%define api.token.constructor %define api.token.constructor