Updated syntax to abbreviate functions defs.

This commit is contained in:
Jacob Signorovitch 2025-06-28 10:55:15 -04:00
parent 3b5bee0695
commit 67aafb3ead
2 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
0. Create file to describe properties of terminology used; param, arg, var, &c.
1. Differenciate parameters and arguments -- params for function definitions,
1. Differentiate parameters and arguments -- params for function definitions,
arguments for function calls
2. Add scope field to all ASTs, and new scope layer for those that need it.
Change editor to GNU Readline.
Make variables persist through lines in the editor.
Return syntax errors as exceptions.

View File

@ -125,11 +125,11 @@ exp:
NUM { $$ = ast_init(AST_TYPE_NUM, ast_num_data_init($1)); }
// Function definitions.
| WORD GROUPS arg GROUPE EQ exp {
| WORD GROUPS arg GROUPE exp {
size_t argc = $3->ln;
AST** argv = $3->buf;
argarr_destroypsv($3);
$$ = ast_init(AST_TYPE_FDEF, ast_fdef_data_init($1, argc, argv, $6));
$$ = ast_init(AST_TYPE_FDEF, ast_fdef_data_init($1, argc, argv, $5));
}
| BLOCKS block BLOCKE {