aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--src/lexer.c7
2 files changed, 8 insertions, 9 deletions
diff --git a/README.md b/README.md
index 9879378..6a06767 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# HALK
-<img src="./resources/HALK_FINAL.svg" width="384" align="right">
+<img src="./resources/HALK_FINAL.svg" width="350" align="right">
*HALK* seeks to be a language.
@@ -27,18 +27,18 @@ You are mistaken.
Usage of *HALK* is not yet a feature of *HALK*.
One can only hope this feature will be added in the future.
-
# Syntax
-*HALK* is a **dubiously-typed**, **procedural**, **interpreted** programming language.
+*HALK* is a **dubiously-typed**, **vaguely-functional**, **interpreted** programming language, with syntax designed to be as
+**minimal** and **consistent** as possible.
Note that all syntax described is liable to sudden and violent change.
-Examples can be found [here](examples/).
+Example programs can be found [here](examples/).
***HALK*** **progress:** 20%
- [x] Lexer
-- [~] Abstract Syntax Tree
+- [ ] Abstract Syntax Tree
- [ ] Parser
- [ ] Doer
- [ ] ?? profit ??
diff --git a/src/lexer.c b/src/lexer.c
index 731210e..6d9d5a8 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -121,9 +121,8 @@ token_t* lexer_collect(lexer_t* lexer, int (*end_char)(char), int fskip, int lsk
size_t len; // length of collected token so far
char* token; // collected token so far
- len = 1;
+ len = 0;
token = calloc(len, sizeof(char));
- token[0] = '\0';
if (fskip) { lexer_next(lexer); }
@@ -133,11 +132,11 @@ token_t* lexer_collect(lexer_t* lexer, int (*end_char)(char), int fskip, int lsk
current = lexer_get_c_as_string(lexer);
token = realloc(
token,
- (len + sizeof(char) * strlen(current))
+ (len + sizeof(current))
);
memcpy(token + len, current, sizeof(char) * strlen(current));
- len += sizeof(char) * strlen(current);
+ len += strlen(current) * sizeof(char);
lexer_next(lexer);
free(current);