Add WIP README.md

I still need to add more examples to it, and as I work on the
language, the syntax will certainly change, and I will hopefully
change the README to reflect these changes as they happen.
This commit is contained in:
germax26 2024-08-11 23:30:40 +10:00
parent 1a04677440
commit 1688296528
Signed by: germax26
SSH Key Fingerprint: SHA256:N3w+8798IMWBt7SYH8G1C0iJlIa2HIIcRCXwILT5FvM

111
README.md Normal file
View File

@ -0,0 +1,111 @@
# Python++
I created this language as a result of my frustrations with Python.
Currently my language is significantly worse than Python, and needs a lot of work before it can be considered functional.
## Hello World
```
print("Hello, World!\n");
```
The following is a non-comprehensive list of stuff that currently works.
## Assignment & Declaration
```
a: str= "Hello, World!\n";
b: int = 0;
c: str;
```
## Structs
```
struct MyStruct {
field1: int,
field2: str,
field3: SomeOtherStruct
}
my_struct: MyStruct = MyStruct{
field1=1,
field2="Hello, World!",
field3=SomeOtherStruct{...} // whatever SomeOtherStruct takes
};
my_struct.field1 = 2;
plus5: int = my_struct.field1 + 5;
```
## Enums
```
enum Weekday {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
day: Weekday = Weekday.Tuesday;
match day in {
case Monday do { ... }
case Tuesday do { ... }
case Wednesday do { ... }
case Thursday do { ... }
case Friday do { ... }
case _ do { ... } // default
}
```
or
```
enum IntResult {
Ok(int),
Err(Error)
}
result: IntResult = Ok(5);
match result in {
case Ok(num) do { ... } // num is defined in this scope
case Err(err) do { ... } // similarly err is defined in this scope
}
```
Currently, polymorphic structs/enums are not supported, however I plan to eventually do so.
## Functions
```
func random_number(seed: int) -> int {
return 42;
}
my_random_number = random_number(69);
func min(a: int, b: int) -> int {
if a < b return a;
return b;
}
the_min = min(5, 10);
```
## Arrays
## For loops
## While loops
## Reading files
## Importing
## Assertions
## Tuples