From 7b735783ed9711d47411794d7d2051ffd3ade646 Mon Sep 17 00:00:00 2001 From: A404M Date: Wed, 18 Sep 2024 21:28:58 +0330 Subject: added README.md some code clean up --- README.md | 37 +++++++++++++++++++++++++++++++++++++ src/compiler/lexer/lexer.c | 5 +---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d0016ee --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# FELan + +A new programming language + +# How to use + +TO compile just run +```sh +./project compile +``` +It would make an executable as `./build/felan` + +Or you can compile and run with +```sh +./project run +``` +Just like compile, it would make an executable as `./build/felan` + +To run code just send your source file to the program like +```sh +felan some_path.felan +# or +./project run some_path.felan +``` + +# Examples + +To print `Hello` with no new line +```felan +print("Hello") +``` + +To print `Hello` with a new line +```felan +print("Hello\n") +``` + diff --git a/src/compiler/lexer/lexer.c b/src/compiler/lexer/lexer.c index 35631f5..5c7c256 100644 --- a/src/compiler/lexer/lexer.c +++ b/src/compiler/lexer/lexer.c @@ -75,9 +75,7 @@ Nodes lexer(char const *restrict str) { push_if_not_empty(&nodes, &nodes_size, &nodes_inserted, &node, str, i, TOKEN_NONE); break; - } - - if (c == '/') { + } else if (c == '/') { const char follow = str[i + 1]; if (follow == '/') { push_if_not_empty(&nodes, &nodes_size, &nodes_inserted, &node, str, i, @@ -280,7 +278,6 @@ bool isOperator(char c) { bool isSymbol(char c) { return c == '#'; } - Token getKeyword(char const *strBegin, char const *strEnd) { const size_t strSize = strEnd - strBegin; -- cgit v1.2.3