]> www.git.momoyon.org Git - lang.git/commitdiff
Update README.md
authorahmedsamyh <ahmedsamyh10@gmail.com>
Mon, 18 Nov 2024 17:24:13 +0000 (22:24 +0500)
committerahmedsamyh <ahmedsamyh10@gmail.com>
Mon, 18 Nov 2024 17:24:13 +0000 (22:24 +0500)
README.md
main.py

index 9cace29e83020feae73b8fea260533007dbba9e7..4387b54edd26bced63fdfec7af74a91d0d733fb4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,3 +1,28 @@
-# Language (unnamed)
+# C+ (WIP name)
 
-Programming Language.
+A Programming Language like the [C Programming Language](https://en.wikipedia.org/wiki/C_(programming_language)) that adds some useful features, different syntax, etc that ultimately transpiles to C itself.
+
+## Goals
+
+- [x] Lexical Analysis (Generate Tokens from source file)
+- [ ] Parsing (Generate a Syntax Tree from the Tokens)
+- [ ] Convert C+ syntax to C syntax
+- [ ] Call C compiler and linker to create the executable
+- [ ] Success!!!
+
+## Why?
+
+I mainly program using C because of its simpilicty. But some features are kinda bad and some even missing such as defer, shitty macros(preprocessor), shitty variadic functions, etc.
+
+- Why not use [C++](https://en.wikipedia.org/wiki/C%2B%2B), doesn't it basically solve all those problems?
+
+Because i don't like feel like its a good language... I'm not an big [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) person and don't get me started on the mess that is called the [templates](https://en.wikipedia.org/wiki/Template_(C%2B%2B)). Anyways i won't use C++ as my main language and i'm not quite satisfied with C, so i wondered "why don't i make my own language that adds these features to C?". And that's what i'm trying to do with this project. I'm not talking about creating a completely new programming language from scratch, just change some syntax of C, add these new features and make some of it better. This is also a great exercise to further increase my wisdom of computers.
+
+TL;DR:
+- I like C but quite not, (don't likey C++) so create C+ that is in the middle.
+- Good opportunity to learn how a programming language works.
+- Because it's fun.
+
+## References
+
+- [Book im reading(The dragon book)](https://drive.google.com/file/d/0B1MogsyNAsj9elVzQWR5NWVTSVE/view?pli=1&resourcekey=0-zoBDMpzTafr6toxDuQLNUg)
diff --git a/main.py b/main.py
index 1f1d1c6e6ca5eebdc1b920b180a491b369c97a4a..9a342bac67aa81bdaa6ce7ba7c9a37bf69d470d9 100644 (file)
--- a/main.py
+++ b/main.py
@@ -304,7 +304,7 @@ class Parser:
 
         return None
 
-    def parse(self) -> [Token]:
+    def lex(self) -> [Token]:
         tokens: [Token] = []
         token = self.next_token()
         while token != None:
@@ -323,8 +323,8 @@ def main():
     filename: str = sys.argv.pop(0)
 
     parser = Parser(filename)
-
-    tokens = parser.parse()
+    # Lexical Analysis
+    tokens = parser.lex()
 
     for t in tokens:
         pprint.pp(str(t))