aboutsummaryrefslogtreecommitdiff
path: root/boot/parser.yy
diff options
context:
space:
mode:
Diffstat (limited to 'boot/parser.yy')
-rw-r--r--boot/parser.yy28
1 files changed, 8 insertions, 20 deletions
diff --git a/boot/parser.yy b/boot/parser.yy
index c34c905..1dd42a8 100644
--- a/boot/parser.yy
+++ b/boot/parser.yy
@@ -129,8 +129,6 @@ along with GCC; see the file COPYING3. If not see
%type <std::vector<elna::boot::expression *>> case_labels;
%type <elna::boot::switch_case> switch_case;
%type <std::vector<elna::boot::switch_case>> switch_cases;
-%type <elna::boot::constant_declaration *> constant_declaration;
-%type <std::vector<elna::boot::constant_declaration *>> constant_part constant_declarations;
%type <elna::boot::variable_declaration *> variable_declaration;
%type <std::vector<elna::boot::variable_declaration *>> variable_declarations variable_part;
%type <elna::boot::type_expression *> type_expression;
@@ -166,14 +164,14 @@ along with GCC; see the file COPYING3. If not see
%type <std::vector<elna::boot::import_declaration *>> import_declarations import_part;
%%
program:
- import_part constant_part type_part variable_part procedure_part statement_part "end" "."
+ import_part type_part variable_part procedure_part statement_part "end" "."
{
- boot::unit *tree = new boot::unit(boot::make_position(@$), $1, $2, $3, $4, $5, $6);
+ boot::unit *tree = new boot::unit(boot::make_position(@$), $1, $2, $3, $4, $5);
driver.tree.reset(tree);
}
procedure_body:
- constant_part variable_part statement_part procedure_return
- { $$ = std::make_unique<boot::procedure_body>($1, $2, $3, $4); }
+ variable_part statement_part procedure_return
+ { $$ = std::make_unique<boot::procedure_body>($1, $2, $3); }
statement_part:
/* no statements */ {}
@@ -444,6 +442,10 @@ type_expression:
{
$$ = new boot::array_type_expression(boot::make_position(@$), $4, $2);
}
+ | "const" type_expression
+ {
+ $$ = new boot::constant_type_expression(boot::make_position(@$), $2);
+ }
| "^" type_expression
{
$$ = new boot::pointer_type_expression(boot::make_position(@$), $2);
@@ -501,20 +503,6 @@ variable_declarations:
variable_part:
/* no variable declarations */ {}
| "var" variable_declarations { $$ = $2; }
-constant_declaration: identifier_definition ":=" expression
- {
- $$ = new boot::constant_declaration(boot::make_position(@$), std::move(*$1), $3);
- }
-constant_declarations:
- constant_declaration constant_declarations
- {
- $$ = $2;
- $$.insert(std::cbegin($$), $1);
- }
- | /* no constant definitions */ {}
-constant_part:
- /* no constant definitions */ {}
- | "const" constant_declarations { $$ = $2; }
import_declaration:
IDENTIFIER "." import_declaration
{