Go to file
2024-08-12 00:16:13 +10:00
plans Fix up do-while.md 2024-08-11 13:07:05 +10:00
ppp Move .ppp files into ppp/ directory 2024-08-11 11:35:49 +10:00
.gitignore Initial commit 2024-08-08 21:54:03 +10:00
ppp_ast.py Make imports expect a string, not an expression 2024-08-12 00:16:13 +10:00
ppp_interpreter.py Make imports expect a string, not an expression 2024-08-12 00:16:13 +10:00
ppp_lexer.py Initial commit 2024-08-08 21:54:03 +10:00
ppp_object.py Remove everything to do with Hashing 2024-08-12 00:05:01 +10:00
ppp_parser.py Make imports expect a string, not an expression 2024-08-12 00:16:13 +10:00
ppp_stdlib.py Remove Dictionaries 2024-08-12 00:00:03 +10:00
ppp_tokens.py Add parsing for defers 2024-08-11 12:59:19 +10:00
ppp_types.py Remove everything to do with Hashing 2024-08-12 00:05:01 +10:00
ppp.py Initial commit 2024-08-08 21:54:03 +10:00
README.md Fix errors in README examples 2024-08-11 23:33:56 +10:00

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; // declared, but not yet assigned

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 = 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: int = random_number(69);

func min(a: int, b: int) -> int {
	if a < b return a;
	return b;
}

the_min: int = min(5, 10);

Arrays

For loops

While loops

Reading files

Importing

Assertions

Tuples