projects
/
sun.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
inline
| side by side (parent:
c14e8cb
)
Fixed syntax for definitions
author
Ben Sherratt
<redacted>
Tue, 30 Jan 2024 18:09:04 +0000
(18:09 +0000)
committer
Ben Sherratt
<redacted>
Tue, 30 Jan 2024 18:09:04 +0000
(18:09 +0000)
runtime/src/sun/compiler/sun.y
patch
|
blob
|
history
diff --git
a/runtime/src/sun/compiler/sun.y
b/runtime/src/sun/compiler/sun.y
index b71f4de442f7da6a17e8c808f04a6a2ab6897349..2464ffac0abdb7ab0ac73dc5ace7169d48812573 100644
(file)
--- a/
runtime/src/sun/compiler/sun.y
+++ b/
runtime/src/sun/compiler/sun.y
@@
-79,39
+79,39
@@
%%
module
%%
module
- : optional_statements
_or_definitions
{
+ : optional_statements {
$$ = sltNodeMakeModule($1);
*moduleOut = $$;
}
;
$$ = sltNodeMakeModule($1);
*moduleOut = $$;
}
;
-optional_statements_or_definitions
- :
/* Nothing */
{
+
/*
optional_statements_or_definitions
+ :
*//* Nothing *//*
{
$$ = NULL;
}
| statements_or_definitions
;
statements_or_definitions
$$ = NULL;
}
| statements_or_definitions
;
statements_or_definitions
- : definition {
+ :
function_
definition {
$$ = sltNodeMakeSequence(NULL, $1);
}
| statement {
$$ = sltNodeMakeSequence(NULL, $1);
}
$$ = sltNodeMakeSequence(NULL, $1);
}
| statement {
$$ = sltNodeMakeSequence(NULL, $1);
}
- | statements_or_definitions definition {
+ | statements_or_definitions
function_
definition {
$$ = sltNodeMakeSequence($1, $2);
}
| statements_or_definitions statement {
$$ = sltNodeMakeSequence($1, $2);
}
$$ = sltNodeMakeSequence($1, $2);
}
| statements_or_definitions statement {
$$ = sltNodeMakeSequence($1, $2);
}
- ;
+ ;
*/
-definition
+
/*
definition
: function_definition
: function_definition
- /*| type_definition*/
+ | type_definition
| variable_definition ';'
| variable_definition ';'
- ;
+ ;
*/
function_definition
: IDENTIFIER IDENTIFIER '(' optional_parameter_definitions ')' '{' optional_statements '}' {
function_definition
: IDENTIFIER IDENTIFIER '(' optional_parameter_definitions ')' '{' optional_statements '}' {
@@
-198,6
+198,7
@@
statement
: ';' {
$$ = NULL; /* Otherwise this will pass up the ';' character */
}
: ';' {
$$ = NULL; /* Otherwise this will pass up the ';' character */
}
+ | function_definition
| variable_definition ';'
| "return" optional_expression ';' {
$$ = sltNodeMakeReturn($2);
| variable_definition ';'
| "return" optional_expression ';' {
$$ = sltNodeMakeReturn($2);