Thanks to visit codestin.com
Credit goes to github.com

Skip to content

use istitle , isalpha on string literal #2380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 162 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
059fb0e
use istitle , isalpha on string literal
Agent-Hellboy Oct 14, 2023
c3deff9
fix test
Agent-Hellboy Oct 14, 2023
d8b9736
resolve comments
Agent-Hellboy Oct 14, 2023
b7b6243
resolve comments
Agent-Hellboy Oct 14, 2023
a41041e
Resolve comments
Agent-Hellboy Oct 15, 2023
e57c7fa
Improve function doc
Agent-Hellboy Oct 15, 2023
2d0119e
Implement random.seed()
OmarMesqq Sep 10, 2023
d081f05
Proper clock initialization stricter tests
certik Oct 17, 2023
1e9e269
Added Support for Symbolic `func` attribute (#2367)
anutosh491 Oct 17, 2023
a66812c
Fixed printing elements from a symbolic list
anutosh491 Oct 17, 2023
0dd0e0b
Implemented query methods for log and exp class
anutosh491 Oct 18, 2023
cc9158b
Removed ExpQ
anutosh491 Oct 18, 2023
aa6df70
Implemented symbolic constant E
anutosh491 Oct 22, 2023
4a4f977
Added tests
anutosh491 Oct 24, 2023
41361cf
Fixed tests
anutosh491 Oct 24, 2023
293e12b
Implemented ASR checks for function dependencies (#2167)
arteevraina Oct 24, 2023
7cd0165
Remove spurious reference results
certik Oct 24, 2023
410ef90
Added query method for sin class
anutosh491 Oct 25, 2023
01d16f9
Remove Python as prerequisite from README.md
ubaidsk Oct 31, 2023
1f17cf4
Implementing get argument through design 1
anutosh491 Oct 28, 2023
89fcb02
Fixed issue with extracting arguments multiple times
anutosh491 Oct 30, 2023
41f8c9a
Added exception
anutosh491 Oct 30, 2023
f00a758
Added assert as the thrid statement
anutosh491 Oct 31, 2023
7597313
Added tests
anutosh491 Oct 31, 2023
7a86c8e
fix: punctuation mistake in error message
pnc009 Nov 2, 2023
bf31386
DEV: Create temporary for IfExp outside LLVM loop
czgdp1807 Nov 2, 2023
d29348b
Added support for visit_Assert through basic_eq
anutosh491 Nov 1, 2023
62234d1
Added tests
anutosh491 Nov 1, 2023
cacce96
refactor: check for dependency only in parent scope
arteevraina Oct 25, 2023
f3bd799
refactor: added logic for associate block & block before adding depen…
arteevraina Nov 4, 2023
1567f04
Implemented visit_Return for freeing variables
anutosh491 Nov 9, 2023
3cdba13
Fixed cases for which basic_free_stack should be defined
anutosh491 Nov 9, 2023
057db16
DEV: Sync libasr with LFortran
czgdp1807 Nov 11, 2023
2334449
DEV: Update libasr API usage in LPython
czgdp1807 Nov 11, 2023
1255b7e
TEST: Updated single_test API
czgdp1807 Nov 11, 2023
d3f4da7
TEST: Updated reference tests
czgdp1807 Nov 11, 2023
19072a2
Support --dump-all-passes, --dump-all-passes-fortran
ubaidsk Nov 10, 2023
739cc69
Remove duplicate flags from CompilerOptions
ubaidsk Nov 12, 2023
8a68f0d
Remove redundant pickle code
ubaidsk Nov 12, 2023
33b16d4
Remove unused generate_visualize_html()
ubaidsk Nov 12, 2023
ad4c6af
Add LPython changes so refs stay the same
ubaidsk Nov 12, 2023
83d5068
Support the --no-loc flag
ubaidsk Nov 12, 2023
ec3e26a
Reuse compiler_options.po for pass_options
ubaidsk Nov 12, 2023
8454775
GIT: Ignore generated files
ubaidsk Nov 12, 2023
88a23f4
Removed redundant return node after processing an ASR through subrout…
anutosh491 Nov 12, 2023
3545c4a
Added support for Out[S] (#2419)
anutosh491 Nov 13, 2023
239357e
Added explicit test for Out[S] (#2422)
anutosh491 Nov 13, 2023
8f38d1e
Bug: [C] Fix a missing indent in C code
Thirumalai-Shaktivel Nov 11, 2023
8277f5e
Bug: Fix the accessing of m_values
Thirumalai-Shaktivel Nov 11, 2023
e4459fb
Fix extra spaces
Thirumalai-Shaktivel Nov 11, 2023
302a4f5
[ASR Pass] Use the utils function to check for SIMDArray
Thirumalai-Shaktivel Nov 13, 2023
f74f6bb
Refactor: [C] Handle ArrayBroadcast for variable initialization
Thirumalai-Shaktivel Nov 14, 2023
324f583
[C] Use memcpy for initializing SIMDArray's
Thirumalai-Shaktivel Nov 15, 2023
adf3b7d
C: Support stride and offset for arrays
ubaidsk Nov 14, 2023
6bd0953
C: Support stride and offset in generate_array_decl()
ubaidsk Nov 14, 2023
bf49995
C: Support stride, offset in visit_CPtrToPointer()
ubaidsk Nov 14, 2023
1740e1d
C: Support array indexing using stride and offset
ubaidsk Nov 14, 2023
c59581e
C: Support visit_Associate()
ubaidsk Nov 14, 2023
ab7c4b9
C_CPP: Support stride, offset for lpython decorator
ubaidsk Nov 14, 2023
c669bb3
C: Fix passing pointer to array
ubaidsk Nov 14, 2023
36e1c5f
C_CPP: Support stride in Allocate
ubaidsk Nov 16, 2023
76abb30
TEST: Update reference tests
ubaidsk Nov 16, 2023
c65ec23
[ASR Pass] Handle ArraySection and SIMDArray BinOp
Thirumalai-Shaktivel Nov 17, 2023
e4b1bae
[C] Fix the allocatable array size
Thirumalai-Shaktivel Nov 17, 2023
4a7a8e3
[ASR Pass] Skip the direct multi-dimensional ArraySection assignment …
Thirumalai-Shaktivel Nov 20, 2023
b5a3df0
[LLVM] Implement SIMDArray
Thirumalai-Shaktivel Nov 20, 2023
c635911
Add tutorial 1
Smit-create Nov 11, 2023
608b3ab
add funcs and loops
Smit-create Nov 25, 2023
12d2cb1
[ASR Pass] Symbolic: Use a function to create `basic_new_stack` BindC…
Thirumalai-Shaktivel Nov 25, 2023
f123606
[ASR Pass] Symbolic: Use a function to create `basic_free_stack` Bind…
Thirumalai-Shaktivel Nov 25, 2023
8774e5a
[ASR Pass] Symbolic: Add `basic_free_stack` to function dependencies
Thirumalai-Shaktivel Nov 25, 2023
efd0d28
[ASR Pass] Symbolic: Simplify `basic_get_args` to return `SubroutineC…
Thirumalai-Shaktivel Nov 25, 2023
da31326
[ASR Pass] Symbolic: Simplify `vecbasic_new` to return `FunctionCall`
Thirumalai-Shaktivel Nov 25, 2023
0c102bd
[ASR Pass] Symbolic: Simplify `vecbasic_get` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
7909080
[ASR Pass] Symbolic: Simplify `vecbasic_size` to return `FunctionCall`
Thirumalai-Shaktivel Nov 25, 2023
728f38b
[ASR Pass] Symbolic: Simplify `basic_assign` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
bc6065f
[ASR Pass] Symbolic: Simplify `basic_str` to return `FunctionCall`
Thirumalai-Shaktivel Nov 25, 2023
5373ba1
[ASR Pass] Symbolic: Simplify `basic_get_type` to return `FunctionCall`
Thirumalai-Shaktivel Nov 25, 2023
10ae9c1
[ASR Pass] Symbolic: Simplify `basic_eq` & `basic_neq` into `basic_co…
Thirumalai-Shaktivel Nov 25, 2023
9b94eca
[ASR Pass] Symbolic: Simplify `integer_set_si` to return `SubroutineC…
Thirumalai-Shaktivel Nov 25, 2023
af4005a
[ASR Pass] Symbolic: Simplify `symbol_set` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
ad25082
[ASR Pass] Symbolic: Simplify `basic_const` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
67716e9
[ASR Pass] Symbolic: Simplify `basic_binop` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
13a5bef
[ASR Pass] Symbolic: Simplify `basic_unaryop` to return `SubroutineCall`
Thirumalai-Shaktivel Nov 25, 2023
77f905c
[ASR Pass] Symbolic: Simplify `process_intrinsic_function` arguments
Thirumalai-Shaktivel Nov 25, 2023
40fd142
[ASR Pass] Symbolic: Simplify `process_intrinsic_function` to use macros
Thirumalai-Shaktivel Nov 25, 2023
3ff17e2
[ASR Pass] Symbolic: Simplify `process_attributes` to use macros
Thirumalai-Shaktivel Nov 25, 2023
a25648e
[ASR Pass] Symbolic: Simplify `basic_has_symbol` to return `FunctionC…
Thirumalai-Shaktivel Nov 25, 2023
c928e6a
[ASR Pass] Symbolic: Simplify `process_attributes` arguments
Thirumalai-Shaktivel Nov 25, 2023
a89176c
changes documentation to represent correct path for lpython on window…
ujjwaltwitx Nov 29, 2023
1440834
[LLVM] Use `8` as the default kind for CPtr
Thirumalai-Shaktivel Nov 25, 2023
eafbf95
[LLVM] Handle `CPtr` `intent::Out` argument
Thirumalai-Shaktivel Nov 25, 2023
e31ef30
Test: Enable llvm tests for symbolic
Thirumalai-Shaktivel Nov 25, 2023
d6592fa
[ASR Pass] Symbolic: Simplify the Subroutine to use a common `create_…
Thirumalai-Shaktivel Nov 25, 2023
24ec9cc
[ASR Pass] Symbolic: Simplify the Function to use a common `create_bi…
Thirumalai-Shaktivel Nov 25, 2023
c502330
[ASR Pass] Symbolic: Simplify the SubroutineCall
Thirumalai-Shaktivel Nov 25, 2023
6908ec9
[ASR Pass] Symbolic: Simplify the FunctionCall
Thirumalai-Shaktivel Nov 25, 2023
3c0804a
[ASR Pass] Symbolic: Handle function with no arguments
Thirumalai-Shaktivel Nov 25, 2023
f25e205
Adding initial test for gruntz
anutosh491 Dec 4, 2023
f8c68a5
Fixed ASR for test_gruntz.py
anutosh491 Dec 6, 2023
e58ddce
Implement str.split()
AkshayWarrier Dec 13, 2023
d0a8888
Update reference tests
AkshayWarrier Dec 13, 2023
bef8f4c
Implemented visit_AsyncFunctionDef in the AST->ASR visitor (#2442)
ujjwaltwitx Dec 14, 2023
7398278
Fixes SEGFAULT in integration_tests/elemental_01.py (#2452)
Kishan-Ved Jan 6, 2024
9ecfab6
Do not load CPtr
certik Dec 6, 2023
5a9aa30
Only use ptr_loads = 0 if it is an argument
certik Jan 3, 2024
efea1bc
Refactored code and added test
anutosh491 Jan 7, 2024
53a6ef6
Update asr_to_llvm.cpp
anutosh491 Jan 7, 2024
b5dd9b2
Fixed output through c_sym backend for test_gruntz.py (#2454)
anutosh491 Jan 10, 2024
a06c4e2
UserOverride.cmake: fix native optflag for PowerPC
barracuda156 Jan 10, 2024
25ef831
stacktrace.cpp: include syslimits.h for PATH_MAX
barracuda156 Jan 10, 2024
d444921
parser_stype.h: allow building for ppc
barracuda156 Jan 10, 2024
7693ecf
lfortran_intrinsics.c: Fix random_number()
ubaidsk Jan 21, 2024
0b20122
lfortran_intrinsics.c: Use nanoseconds to seed random
ubaidsk Jan 21, 2024
2b5cafc
TEST: Add for random()
ubaidsk Jan 23, 2024
d7d89ec
TEST: Print vals and comment out failing test
ubaidsk Jan 23, 2024
03fea2e
Using basic_new_heap for assigning elements of symbolic list
anutosh491 Jan 30, 2024
a376923
Added support for freeing variables
anutosh491 Jan 31, 2024
d12b4c6
Fixing Symbolic List assignment
anutosh491 Feb 4, 2024
1d28f40
Fixed failing test
anutosh491 Feb 4, 2024
033e941
Maded suitable changes in symbolics_15.py
anutosh491 Feb 4, 2024
3bcad07
Added tests
anutosh491 Feb 4, 2024
07b00db
Added comments
anutosh491 Feb 4, 2024
000b437
Fixes empty string bug in str isalpha method
advikkabra Feb 5, 2024
1f86ca6
Fix const step in loop
ubaidsk Feb 7, 2024
420f66a
TEST: Add for const step in loop
ubaidsk Feb 7, 2024
49eec2b
fixes semantic error for int (Issue #1926)
NishantBansal2003 Feb 4, 2024
abaac3e
Improved int semantic error message with hint (Issue #1926)
NishantBansal2003 Feb 5, 2024
77520bb
Added Reference test (Issue #1926)
NishantBansal2003 Feb 5, 2024
0114391
Fixing symbolic compare for test_gruntz.py
anutosh491 Feb 6, 2024
ac101db
Added tests
anutosh491 Feb 8, 2024
f9245df
Fixed issue #1993 to improve readability of semantic error thrown
tanay-man Feb 8, 2024
aaf8ae1
Fixed grammatical errors (Issue #2493) (#2510)
NishantBansal2003 Feb 8, 2024
51decc8
CI: Disable C tests on macOS
certik Feb 8, 2024
8762d11
Fix a bug in Const[int]
certik Feb 8, 2024
662a2e9
CI: Remove more tests on macOS
certik Feb 9, 2024
b40c654
CI: Enable LLVM and C backends on macOS
certik Feb 9, 2024
cfacf1e
Improving prefix-string parsing (fixes #2339) (#2511)
mrdaybird Feb 9, 2024
c6de400
Ignored warnings for inbuilt pow test
advikkabra Feb 11, 2024
f789c91
Fixes isspace edge case
advikkabra Feb 6, 2024
cff00a2
Added test for isspace, fixed similar issue in ast_to_asr
advikkabra Feb 7, 2024
b03da1d
Typo fix
advikkabra Feb 7, 2024
7f7f388
Add test for constant empty string
advikkabra Feb 10, 2024
6a11d34
Added case to support log instances in mrv function
anutosh491 Feb 12, 2024
a9eff5c
Added semantic error for float declaration. (#2529)
faze-geek Feb 13, 2024
19001d6
Fixed visit_if for SymbolicCompare cases
anutosh491 Feb 15, 2024
15c7707
Added a step-by-step documentation for installing and building LPython.
kmr-srbh Feb 16, 2024
028efa6
Fixed a typo
kmr-srbh Feb 16, 2024
ce565a5
Update installation instructions
kmr-srbh Feb 16, 2024
72dd7ff
refine input file missing msg (#2536)
syheliel Feb 17, 2024
24c8d3c
Improved str.count() algorithm using Knuth-Morris-Pratt
advikkabra Feb 12, 2024
c946cda
Added implementation for constant strings and tests for str.count
advikkabra Feb 12, 2024
5b9d0fd
refine testcase for random
syheliel Feb 18, 2024
c5e86d8
Added `zstd-static` package to the conda environment configuration fi…
kmr-srbh Feb 18, 2024
f5a772c
Refactor string attributes and add constant string implementations (#…
advikkabra Feb 18, 2024
b7a1ebc
Remove submodule `lpython` (#2548)
Thirumalai-Shaktivel Feb 19, 2024
036d888
updated cmake version for windows
Kishan-Ved Feb 28, 2024
6c2340e
Fixing symbolic pass according to error caught in LFortran (#2565)
anutosh491 Mar 2, 2024
29efe10
Implemented numpy.hypot
Kishan-Ved Mar 4, 2024
c72d507
use istitle , isalpha on string literal
Agent-Hellboy Oct 14, 2023
29ee579
resolve comments
Agent-Hellboy Oct 14, 2023
a015d76
Update references
Agent-Hellboy Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install Windows Conda Packages
if: contains(matrix.os, 'windows')
shell: bash -e -l {0}
run: conda install m2-bison=3.0.4
run: conda install m2-bison=3.0.4 cmake=3.21.1

- name: Install Linux / macOS Conda Packages
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ integration_tests/b5/*
integration_tests/b6/*
integration_tests/_lpython-tmp-test-*
inst/bin/*
*.clj
pass_fortran_*.f90
pass_json_*.json
pass_tree_*.txt
*.tmp
*.tlog
*.filters
Expand Down
337 changes: 121 additions & 216 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# LPython

LPython is a Python compiler. It is in heavy development, currently in alpha
stage. LPython works on Windows, macOS and Linux. Some of the goals of LPython
include:

- The best possible performance for numerical, array-oriented code
- Run on all platforms
- Compile a subset of Python yet be fully compatible with Python
- Explore designs so that LPython eventually can compile all Python code
- Fast compilation
- Excellent user-friendly diagnostic messages: error, warnings, hints, notes,
etc.
- Ahead-of-Time compilation to binaries, plus interactive usage (Jupyter notebook)
- Transforming Python code to C++, Fortran and other languages

And more.
LPython is an ahead-of-time compiler for Python written in C++. It is currently in alpha
stage and under heavy development. LPython works on Windows, macOS and Linux.

Some of the goals of LPython include:

- Providing the best possible performance for numerical and array-oriented code.
- Ahead-of-Time, fast compilation to binaries, plus interactive usage (Jupyter notebook).
- Cross-platform support.
- Being able to compile a subset of Python yet be fully compatible with it.
- Transforming Python code to other programming languages like C++ and Fortran.
- Exploring design patterns so that LPython can eventually compile all Python code.
- Providing excellent user-friendly diagnostic messages: error, warnings, hints, notes, etc.

among many more.

# Sponsors

Expand All @@ -25,231 +24,137 @@ LFortran, see that project for a list of sponsors.

# Installation

## Step 0: Prerequisites

Here is the list of requirements needed to build LPython:

- Python (3.10+)
- Conda

For Windows, these are additionally required:

- Miniforge Prompt
- Visual Studio (with "Desktop Development with C++" workload)

Please follow the steps for your desired platform.

## Step 1: Install Conda

This step involves installing Conda using a conda-forge distribution called Miniforge.

Please follow the instructions here to install Conda on your platform:

Miniforge download link (for Linux, MacOS and Windows): https://github.com/conda-forge/miniforge/#download

## Step 2: Setting up

This step involves setting up the required configuration to run the programs in LPython.

### Linux

Run the below command to install `binutils-dev` package on Linux.

```bash
sudo apt install binutils-dev
```

### Windows

Please follow the below steps for Windows:

- Install Visual Studio, for example the version 2022.

- You can download the
Community version for free from: https://visualstudio.microsoft.com/downloads/.
- After installing Visual Studio and running the Visual Studio Installer, you must install the "Desktop Development with C++" workload which will install Visual C++ Compiler (MSVC).

- Launch the Miniforge prompt from the Desktop.

- It is recommended to use MiniForge instead of Powershell as the main terminal to build and write code for LPython.

- In the MiniForge Prompt, initialize the MSVC compiler using the below command:

```bash
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
```

- You can optionally test MSVC via:

```bash
cl /?
link /?
```

Both commands must print several pages of help text.

## Step 3: Build LPython

- Clone LPython using the following commands

```bash
git clone https://github.com/lcompilers/lpython.git
cd lpython
```

You may also use GitHub Desktop to do the same.

### Linux and MacOS

- Create a Conda environment using the pre-existing file:

```bash
conda env create -f environment_unix.yml
conda activate lp
```

- Generate prerequisite files; build in Debug Mode:

```bash
# if you are developing on top of a forked repository; please run following command first
# ./generate_default_tag.sh


./build0.sh
./build1.sh
```

### Windows

- Create a Conda environment using the pre-existing file:

```bash
conda env create -f environment_win.yml
conda activate lp
```

- Generate prerequisite files; build in Release Mode:

```bash
call build0.bat
call build1.bat
```

- Tests and examples

```bash
ctest
inst\bin\lpython examples\expr2.py
inst\bin\lpython examples\expr2.py -o a.out
a.out
```

- Whenever you are updating a test case file, you also need to update all the reference results associated with that test case:

```
python run_tests.py -u --skip-run-with-dbg
```

- To see all the options associated with LPython test suite, use:

```
python run_tests.py --help
```

## Tests:

### Linux or MacOS

- Run tests:

```bash
ctest
./run_tests.py
```

- Run integration tests:

```bash
cd integration_tests
./run_tests.py
```
- Troubleshooting on MacOS latest version:
- In case of recently updated MacOS, you may get a warning like below in some test cases:
```bash
ld: warning: object file (test_list_index2.out.tmp.o) was built for newer macOS version (14.0) than being linked (13.3)
```
This leads to mismatch of hashes with expected output in some test cases, this can be resolved by updating command line tools. Below is a snippet for the same.
Follow the steps below to install and run LPython on Linux, Windows or macOS.

## Prerequisites
- ### Install Conda
Follow the instructions provided [here](https://github.com/conda-forge/miniforge/#download) to install Conda on your platform (Linux, macOS and Windows) using a conda-forge distribution called Miniforge.

For Windows, these are additional requirements:
- Miniforge Prompt
- Visual Studio (with "Desktop Development with C++" workload)

- ### Set up your system
- Linux
- Run the following command to install some global build dependencies:

```bash
sudo apt-get install build-essential binutils-dev clang zlib1g-dev
```
- Windows
- Download and install [Microsoft Visual Studio Community](https://visualstudio.microsoft.com/downloads/) for free.

- Run the Visual Studio Installer. Download and install the "Desktop Development with C++" workload which will install the Visual C++ Compiler (MSVC).

- Launch the Miniforge prompt from the Desktop. It is recommended to use MiniForge instead of Powershell as the main terminal to build and write code for LPython. In the MiniForge Prompt, initialize the MSVC compiler using the below command:

```bash
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
```

You can optionally test MSVC via:

```bash
cl /?
link /?
```

Both commands must print several pages of help text.

- Windows with WSL
- Install Miniforge Prompt and add it to path:
```bash
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/conda_root
export PATH="$HOME/conda_root/bin:$PATH"
conda init bash # (shell name)
```
- Open a new terminal window and run the following commands to install dependencies:
```bash
conda create -n lp -c conda-forge llvmdev=11.0.1 bison=3.4 re2c python cmake make toml clangdev git
```

- Optionally, you can change the directory to a Windows location using `cd /mnt/[drive letter]/[windows location]`. For e.g. - `cd mnt/c/Users/name/source/repos/`.


- ### Clone the LPython repository
Make sure you have `git` installed. Type the following command to clone the repository:

```bash
git clean -dfx
sudo rm -rf /Library/Developer/CommandLineTools # make sure you know what you're doing here
sudo xcode-select --install
./build.sh
./run_tests.py
git clone https://github.com/lcompilers/lpython.git
cd lpython
```

You may also use GitHub Desktop to do the same.

## Building LPython
- ### Linux and macOS
- Create a Conda environment:

### Windows
```bash
conda env create -f environment_unix.yml
conda activate lp
```

- Run integration tests
- Generate the prerequisite files and build in Debug Mode:

```bash
python run_tests.py --skip-run-with-dbg
```
```bash
# if you are developing on top of a forked repository; please run following command first
# ./generate_default_tag.sh

- Update reference tests

```bash
python run_tests.py -u --skip-run-with-dbg
```
./build0.sh
./build1.sh
```

## Speed up Integration Tests on MacOS
- ### Windows
- Create a Conda environment using the pre-existing file:

Integration tests run slowly because Apple checks the hash of each
executable online before running.
```bash
conda env create -f environment_win.yml
conda activate lp
```

You can turn off that feature in the Privacy tab of the Security and Privacy item of System Preferences > Developer Tools > Terminal.app > "allow the apps below
to run software locally that does not meet the system's security
policy."
- Generate the prerequisite files and build in Release Mode:

## Examples (Linux or MacOS)
```bash
call build0.bat
call build1.bat
```
- ### Windows with WSL

You can run the following examples manually in a terminal:
- Activate the Conda environment:
```bash
conda activate lp
```

```bash
./src/bin/lpython examples/expr2.py
./src/bin/lpython examples/expr2.py -o expr
./expr
./src/bin/lpython --show-ast examples/expr2.py
./src/bin/lpython --show-asr examples/expr2.py
./src/bin/lpython --show-cpp examples/expr2.py
./src/bin/lpython --show-llvm examples/expr2.py
./src/bin/lpython --show-c examples/expr2.py
```
- Run the following commands to build the project:
```bash
./build0.sh
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .\
make -j8
```
Check the [installation-docs](./doc/src/installation.md) for more.

## Contributing

We welcome contributions from anyone, even if you are new to compilers or to
open source. It might sound daunting to contribute to a compiler at first, but
please do, it is not complicated. We will help you with technical issues and
help improve your contribution so that it can be merged.
We welcome contributions from anyone, even if you are new to compilers or open source in general.
It might sound daunting at first to contribute to a compiler, but do not worry, it is not that complicated.
We will help you with any technical issues you face and provide support so your contribution gets merged.

To contribute, submit a Pull Request (PR) against our repository at:
To contribute, submit a Pull Request (PR) against our repository at: https://github.com/lcompilers/lpython

https://github.com/lcompilers/lpython
Do not forget to clean your history, see [example](./doc/src/rebasing.md).

and don't forget to clean your history, see [example](./doc/src/rebasing.md).
See the [CONTRIBUTING](CONTRIBUTING.md) document for more information.

Please report any bugs you may find at our issue tracker:
https://github.com/lcompilers/lpython/issues. Or, even better, fork the
repository on GitHub and create a PR. We welcome all changes, big or small, and
we will help you make a PR if you are new to git.
## Found a bug?
Please report any bugs you find at our issue tracker [here](https://github.com/lcompilers/lpython/issues). Or, even better, fork the repository on GitHub and create a Pull Request (PR).

If you have any questions or need help, please ask us at Zulip ([![project
chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://lfortran.zulipchat.com/))
or our [mailinglist](https://groups.io/g/lfortran).
We welcome all changes, big or small. We will help you make a PR if you are new to git.

If you have any questions or need help, please ask us at [Zulip](https://lfortran.zulipchat.com/) or on our [mailinglist](https://groups.io/g/lfortran).

See the [CONTRIBUTING](CONTRIBUTING.md) document for more information.

# Star History

Expand Down
Loading