lpython
lpython copied to clipboard
Python compiler
```python print("a", "b", "c", "d") fruits: list[str] = ["apple", "guava", "mango"] mango: str = fruits.pop() print("I have got a", mango, "to eat!") ``` ### CPython ```console (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ python ./examples/example.py...
```console % cat examples/expr2.py raise TypeError("Some error") % python examples/expr2.py Traceback (most recent call last): File "/Users/ubaid/Desktop/OpenSource/lpython/examples/expr2.py", line 1, in raise TypeError("Some error") TypeError: Some error % lpython examples/expr2.py ERROR...
```console % cat examples/expr2.py from lpython import i32 a: list[i32] a = [2, 3] b: list[i32] b = list(a) print(b) % python examples/expr2.py [2, 3] % lpython examples/expr2.py semantic error:...
```python from lpython import CPtr A : CPtr def foo(a : CPtr) -> None: pass foo(A) ``` ``` (lp) ┌─(~/Documents/GitHub/lpython/integration_tests)───(brian@MacBook-Pro:s001)─┐ └─(19:55:25 on vector-backend ✹ ✭)──> lpython ../ISSUES/UNHANDLED-EXCEPTIONS/Issue2487.py ``` ``` (lp)...
This is my attempt at adding support for for-else (issue #1442, according to [czgdp1807's comment](https://github.com/lcompilers/lpython/issues/1442#issuecomment-1434764718)). A new ASR node `ForElse` is added. In `visit_For()` at `python_ast_to_asr.cpp`, loops with non-zero `n_orelse`...
Currently, I think `conda-forge/miniforge` don't support FreeBSD (or any other BSD). The current README also doesn't hint any way to use LPython in FreeBSD (or NetBSD/DragonflyBSD/OpenBSD). I manage to compile...
This modification will print a specific error message ("Error: The input file does not exist") and exit with a return code of 1 if the input file doesn't exist. It...
```python d: dict[str, str] = {"a": "hello", "b": "lpython"} d.keys() ``` ```console (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py Internal Compiler Error: Unhandled exception Traceback (most recent call last): Binary file "/home/saurabh-kumar/Projects/System/lpython/src/bin/lpython", in...
### Working ```python def fn(): alphabets: list[str] = ["a", "b", "c", "d", "e"] print("Original:", alphabets) reversed_alphabets: list[str] = reversed(alphabets) print("Reversed:", reversed_alphabets) fn() ``` ```console (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py Original: ['a',...