Read the input filename from the command line
This commit is contained in:
@ -111,49 +111,34 @@
|
||||
%type <elna::boot::cast_expression *> cast_expression;
|
||||
%%
|
||||
program:
|
||||
type_part constant_part procedure_part variable_part BEGIN_BLOCK optional_statements END_BLOCK DOT
|
||||
type_part constant_part variable_part procedure_part BEGIN_BLOCK optional_statements END_BLOCK DOT
|
||||
{
|
||||
std::vector<elna::boot::definition *> definitions($1.size() + $3.size());
|
||||
std::vector<elna::boot::definition *> definitions($1.size() + $4.size());
|
||||
std::vector<elna::boot::definition *>::iterator definition = definitions.begin();
|
||||
std::vector<elna::boot::definition *> value_definitions($2.size() + $4.size());
|
||||
std::vector<elna::boot::definition *>::iterator value_definition = value_definitions.begin();
|
||||
|
||||
for (auto type : $1)
|
||||
{
|
||||
*definition++ = type;
|
||||
}
|
||||
for (auto constant : $2)
|
||||
{
|
||||
*value_definition++ = constant;
|
||||
}
|
||||
for (auto procedure : $3)
|
||||
for (auto procedure : $4)
|
||||
{
|
||||
*definition++ = procedure;
|
||||
}
|
||||
for (auto variable : $4)
|
||||
{
|
||||
*value_definition++ = variable;
|
||||
}
|
||||
auto tree = new elna::boot::program(elna::boot::make_position(@5),
|
||||
std::move(definitions), std::move(value_definitions), std::move($6));
|
||||
auto tree = new elna::boot::program(elna::boot::make_position(@5), std::move(definitions));
|
||||
|
||||
std::swap(tree->constants, $2);
|
||||
std::swap(tree->variables, $3);
|
||||
std::swap(tree->body, $6);
|
||||
|
||||
driver.tree.reset(tree);
|
||||
}
|
||||
block: constant_part variable_part BEGIN_BLOCK optional_statements END_BLOCK
|
||||
{
|
||||
std::vector<elna::boot::definition *> definitions($1.size() + $2.size());
|
||||
std::vector<elna::boot::definition *>::iterator definition = definitions.begin();
|
||||
$$ = new elna::boot::block(elna::boot::make_position(@3));
|
||||
|
||||
for (auto constant : $1)
|
||||
{
|
||||
*definition++ = constant;
|
||||
}
|
||||
for (auto variable : $2)
|
||||
{
|
||||
*definition++ = variable;
|
||||
}
|
||||
$$ = new elna::boot::block(elna::boot::make_position(@3),
|
||||
std::move(definitions), std::move($4));
|
||||
std::swap($$->constants, $1);
|
||||
std::swap($$->variables, $2);
|
||||
std::swap($$->body, $4);
|
||||
}
|
||||
procedure_definition:
|
||||
PROCEDURE IDENTIFIER formal_parameter_list SEMICOLON block SEMICOLON
|
||||
|
Reference in New Issue
Block a user