This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hassanalinali/develop
Version 0.4.0
- Loading branch information
Showing
51 changed files
with
1,157 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
branches: | ||
ignore: gh-pages | ||
docker: | ||
- image: circleci/python:3.7.2 | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env bash | ||
|
||
# Pytest | ||
echo "Running pre-commit hooks" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
python -m nuitka src/les.py --include-package=lesma --standalone --nofollow-imports --remove-output --python-flag=no_site --plugin-disable=pylint-warnings | ||
#!/usr/bin/env bash | ||
pyinstaller src/les.py -D -n lesma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,25 @@ | ||
# TODO | ||
|
||
## Fixes | ||
- [ ] Fix Type declaration not expecting square brackets (for lists) | ||
- [ ] Fix input function | ||
- [ ] Fix not being able to return user-defined structs and classes | ||
- [ ] Fix not being able to overload operators on user-defined structs and classes | ||
- [ ] Unicode doesn't print properly on Windows platforms | ||
- [ ] Fix string and list type declaration not working | ||
- [ ] Fix base unary operators being applied before user defined ones | ||
- [ ] Fix unicode on windows | ||
|
||
## Improvements | ||
- [ ] Allow any type for lists/tuples (currently only int) | ||
- [ ] Allow more operators on different types such as strings | ||
- [ ] Improve warning messages | ||
- [ ] Add indentation related errors | ||
- [x] Add docs for as and is | ||
- [ ] Add docs for mixed arithmetic | ||
- [ ] Remove clang as a dependency | ||
- [ ] Move error messages from source files to typechecker | ||
- [ ] Fix array types not working and empty lists | ||
- [ ] Catch struct/class used parameters that are not initialized | ||
- [ ] Add support for functions with same name but different parameters | ||
- [ ] Fix local - global variable behaviour, currently there's an implicit main func | ||
- [ ] Allow strings to be used in equalities | ||
- [ ] Use dataclasses and static typing as much as possible in source code | ||
- [ ] String/Lists are currently unsupported on: input function, operators, etc. | ||
- [ ] Find a way to use pointers and null for FFI but restrict or disallow it in normal Lesma | ||
|
||
## Features | ||
- [ ] Implement Null (maybe someday) | ||
- [x] Implement Tuples | ||
- [ ] Implement Class inheritance | ||
- [ ] Implement Dictionary | ||
- [ ] Implement 'in' as a boolean result | ||
- [x] Implement anonymous functions | ||
- [ ] Implement Closure | ||
- [ ] Implement string interpolation | ||
- [ ] Implement Enums | ||
- [x] Implement defer keyword | ||
- [x] Implement fallthrough and change switch's behaviour | ||
- [ ] Implement lambda functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
**Classes** are objects that bundle fields and methods to provide additional functionality that you can further use as a type for any variable, which can then be further expanded using operator overloading and other type-specific behaviour. Classes members can be accessed using a dot `.`. | ||
|
||
Classes **require a constructor to be specified**. | ||
|
||
## Example | ||
```py | ||
class Vehicle | ||
# Constructor | ||
def new(year: int, color: str) | ||
this.year = year | ||
this._color = color | ||
# Privatising the color field, won't be accessible from outside | ||
|
||
# Inheritance | ||
class Car(Vehicle) | ||
def new(year: int, color='green', hatchback=false) | ||
this.hatchback = hatchback | ||
super.Vehicle(year, color) | ||
|
||
def print_year() -> void | ||
print('This car was made in {self.year}') | ||
|
||
ford = Car(1992) | ||
|
||
print(ford.hatchback) | ||
ford.print_year() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
**Enums** (enumerations) are a set of symbolic names bound to unique, constant values. Enum members can be accessed using the dot `.`. | ||
|
||
## Example | ||
```py | ||
enum Color | ||
Red | ||
White | ||
|
||
white: Color = Color.White # Enum members are accessed using a dot | ||
red: Color = Color.Red | ||
print(white != red) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
**Structs** fill a similar role to Python's dataclasses, which you can describe as "mutable namedtuples with defaults", but they're stricter in the sense that **they're not disguised classes**, you can not define methods or other class-specific behaviour, but they can still be extended by overloading operators and they are still defined as a type in Lesma. Struct members can be accessed using the dot `.`. | ||
|
||
All the fields of a struct are required arguments on initialization unless a default is provided. | ||
|
||
## Example | ||
```py | ||
struct Circle | ||
radius: int | ||
x: int | ||
y: int = 4 | ||
|
||
cir: Circle = Circle(radius=5, x=2) | ||
|
||
print(cir.radius) # Members of a struct are accessed using a dot. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.