Skip to content

Commit

Permalink
3.lépés
Browse files Browse the repository at this point in the history
  • Loading branch information
gabboraron authored Nov 25, 2019
1 parent c6b4d11 commit 9199980
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions assign1/Parser.ih
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inline int Parser::lex()
{
int ret = lexer.yylex();
d_loc__.first_line = lexer.lineno();
if( ret == IDENT )
{
d_val__.szoveg = new std::string(lexer.YYText());
}
return ret;
}

Expand Down
10 changes: 9 additions & 1 deletion assign1/assign.y
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
%baseclass-preinclude "semantics.h"
%lsp-needed

%union
{
std::string *szoveg;
}

%token <szoveg> IDENT;
%token NATURAL;
%token BOOLEAN;
%token TRUE;
%token FALSE;
%token NUMBER;
%token IDENT;
%token ASSIGN;

%%
Expand All @@ -23,6 +28,9 @@ declarations:

declaration:
NATURAL IDENT
{
std::cout << *$2 << std::endl;
}
|
BOOLEAN IDENT
;
Expand Down

0 comments on commit 9199980

Please sign in to comment.