Skip to content

Commit

Permalink
Grammar
Browse files Browse the repository at this point in the history
* implemented the missing TODO for the default program initialization,
  which lead to a error state in the new symbol resolver pass from ref
  sealangdotorg/sea#22
  - fixes sealangdotorg/sea#24
  • Loading branch information
ppaulweber committed Apr 3, 2017
1 parent 4376d84 commit ee74d95
Show file tree
Hide file tree
Showing 2 changed files with 349 additions and 327 deletions.
13 changes: 12 additions & 1 deletion src/GrammarParser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@
return libcasm_fe::Ast::make< FunctionDefinition >( sourceLocation, program, argTypes, ruleRefType );
}

static DirectCallExpression::Ptr createSelfBuiltinCall( Location& sourceLocation )
{
const auto self = libcasm_fe::Ast::make< IdentifierNode >( sourceLocation, "self" );
const auto arguments = libcasm_fe::Ast::make< Expressions >( sourceLocation );
return libcasm_fe::Ast::make< DirectCallExpression >( sourceLocation, self, arguments );
}

static Rule::Ptr wrapInBlockRule( const Rule::Ptr& rule )
{
if( (rule->id() == Node::ID::BLOCK_RULE )
Expand Down Expand Up @@ -382,7 +389,11 @@ ProgramFunctionDefinition
auto programDefinition = createProgramFunction( @$ );

auto arguments = libcasm_fe::Ast::make< Expressions >( @$ );
// TODO add `default` agent to arguments

// single execution agent case, use 'self' built-in!
const auto self = createSelfBuiltinCall( @$ );
arguments->add( self );

const auto program = libcasm_fe::Ast::make< DirectCallExpression >(
@$, programDefinition->identifier(), arguments );

Expand Down
Loading

0 comments on commit ee74d95

Please sign in to comment.