Compare commits

...

2 Commits

Author SHA1 Message Date
f0622cbb3f minor fixes 2024-07-19 00:22:38 +02:00
a52fd95965 add .clang-format 2024-07-18 23:37:54 +02:00
5 changed files with 22 additions and 10 deletions

14
.clang-format Normal file
View File

@ -0,0 +1,14 @@
BasedOnStyle: WebKit
IndentWidth: 4
ColumnLimit: 80
IndentCaseLabels: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
SplitEmptyFunction: false
AlignAfterOpenBracket: BlockIndent
AlignOperands: AlignAfterOperator
BreakBeforeBinaryOperators: true
BinPackArguments: false
BinPackParameters: false

2
.gitignore vendored
View File

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

View File

@ -26,17 +26,13 @@
// boilerplate for this small example. Bummer.
%}
%option nodefault
%option noyywrap
%option c++
%option yyclass="Lexer"
%option prefix="stela_"
%option nodefault noyywrap noyylineno c++ yyclass="Lexer" prefix="stela_"
%%
[a-z]+ {
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 "parser.hpp"
#include "interpreter.hpp"
#include <iostream>
int main()
{
@ -10,4 +10,3 @@ int main()
std::cout << "Prase completed with result: " << result << '\n';
return result;
}

View File

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