Skip to content

Commit

Permalink
Grammar Parser
Browse files Browse the repository at this point in the history
* moved self definition inside the specification node
  - related to sealangdotorg/sea#19
  - related to sealangdotorg/sea#22
  - related to sealangdotorg/sea#20
* generated grammar parser
  • Loading branch information
ppaulweber committed Apr 19, 2017
1 parent 418a260 commit 65ebbbe
Show file tree
Hide file tree
Showing 2 changed files with 346 additions and 338 deletions.
8 changes: 6 additions & 2 deletions src/GrammarParser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ Specification
const std::string& fileName = filePath.substr( filePath.find_last_of( "/\\" ) + 1 );
const std::string& name = fileName.substr( 0, fileName.rfind( "." ) );

auto selfDefinition = createSelfFunction( @$ );
$2->add( selfDefinition );

const auto specificationName = make< Identifier >( @$, name );
result = Ast::make< Specification >( @$, specificationName, $2 );
}
Expand Down Expand Up @@ -407,10 +410,11 @@ MaybeFunctionParameters
ProgramFunctionDefinition
: INIT IdentifierPath
{
auto selfDefinition = createSelfFunction( @$ );
const auto selfIdentifier = Ast::make< Identifier >( @$, "self" );

auto selfArguments = libcasm_fe::Ast::make< Expressions >( @$ );
const auto self = libcasm_fe::Ast::make< DirectCallExpression >(
@$, asIdentifierPath( selfDefinition->identifier() ), selfArguments );
@$, asIdentifierPath( selfIdentifier ), selfArguments );

auto programDefinition = createProgramFunction( @$ );
auto programArguments = libcasm_fe::Ast::make< Expressions >( @$ );
Expand Down
Loading

0 comments on commit 65ebbbe

Please sign in to comment.