diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-15 23:41:05 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-15 23:41:33 +0100 |
commit | c08b0e3791c2d96d0d54de4c3e099fa0428ad395 (patch) | |
tree | b0ba84ecabb28f1072f3859523c4eada0f4e4f84 | |
parent | bd485fb4527a1d171e2afbc94cd092444a67303f (diff) | |
download | golem-c08b0e3791c2d96d0d54de4c3e099fa0428ad395.tar.gz |
simplify function declaration syntax
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | identify.c | 4 | ||||
-rw-r--r-- | identify.h | 2 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mvp.golem | 8 | ||||
-rw-r--r-- | onlymain.golem | 4 |
6 files changed, 16 insertions, 14 deletions
@@ -13,12 +13,12 @@ Work in progress bytecode language created by and for [kdx](https://kdx.re). global g_heap; global g_another g_one; -main(argc argv) { +main argc argv { local hello; local world; g_heap = 8000; - hello = (strdup "bonjour"); + hello = (strdup "bonjour");;; world = (strdup "monde"); (print hello); (print " "); @@ -27,7 +27,7 @@ main(argc argv) { return 0; } -alloc(size) { +alloc size { local ptr; ptr = g_heap; @@ -36,7 +36,7 @@ alloc(size) { return heap; } -strdup(str) { +strdup str { local dest; local i; @@ -53,7 +53,7 @@ strdup(str) { return dest; } -print(str) { +print str { local i; i = 1; @@ -2,9 +2,9 @@ #include <stddef.h> void -identify_function(Token **list) +identify_function(Token *list) { - for (Token *e = *list; e != NULL; e = e->next) + for (Token *e = list; e != NULL; e = e->next) if (token_isgroup(e, GROUP_ATOM)) e->group.type = GROUP_FUNCTION; } @@ -1,4 +1,4 @@ #pragma once #include "token.h" -void identify_function(Token **list); +void identify_function(Token *list); @@ -3,6 +3,7 @@ #include "lexer.h" #include "token.h" #include "group.h" +#include "identify.h" #include <stdio.h> #include <stdlib.h> @@ -36,6 +37,7 @@ main(int argc, char **argv) destroy_duplicates(&tokens, TOK_END); group_scope(&tokens); group_atom(&tokens); + identify_function(tokens); token_print(tokens, 1, 0); token_destroy(tokens); } @@ -6,7 +6,7 @@ global g_heap; global g_another g_one; -main(argc argv) { +main argc argv { local hello; local world; @@ -20,7 +20,7 @@ main(argc argv) { return 0; } -alloc(size) { +alloc size { local ptr; ptr = g_heap; @@ -29,7 +29,7 @@ alloc(size) { return heap; } -strdup(str) { +strdup str { local dest; local i; @@ -46,7 +46,7 @@ strdup(str) { return dest; } -print(str) { +print str { local i; i = 1; diff --git a/onlymain.golem b/onlymain.golem index e973537..43556bb 100644 --- a/onlymain.golem +++ b/onlymain.golem @@ -1,4 +1,4 @@ -main(argc argv) { +main argc argv { (print [argv (sub argc 1)]); return (less argc 2); -}; +} |