Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.9%) to scientific vocabulary
Keywords
Repository
An optimizing ahead-of-time Python Compiler
Basic Info
- Host: GitHub
- Owner: Pylir
- License: apache-2.0
- Language: C++
- Default Branch: main
- Homepage: https://pylir.github.io/Pylir/
- Size: 7.23 MB
Statistics
- Stars: 168
- Watchers: 6
- Forks: 8
- Open Issues: 5
- Releases: 0
Topics
Metadata Files
README.md
Pylir
pylir is an optimizing ahead-of-time compiler for python. Goal of the project is therefore to compile python code to
native executables that run as fast as possible through the use of optimizations. Despite being ahead-of-time one of the
goals is to achieve as high of language conformance as is possible and reasonable.
Usage
pylir has a GCC style command line interface, with all options listable via pylir --help.
To compile a python program, simply pass the main module of your python program to the compiler: pylir test.py.
This will then produce an executable called test (test.exe on Windows). Using the -o flag you can change the name of
the binary.
The current default is to not apply any optimizations. To enable optimizations pass -O3 as a command line flag.
Status
Pylir is very much work in progress. The Frontend parts were first completed and are almost fully complete and support
parsing Python 3.9 code. The compiler can already compile many builtin types and some functions from the builtins
namespace such as print are already available. Some operators are already implemented but others are yet to be
implemented. Exception handling is complete and a very basic Garbage Collector is already implemented.
A good way to check on current language conformance is to take a look at the testsuite for it here.
Most time is currently spent working on the optimizer.
Technologies used
Pylir is written from scratch in C++17 and uses following notable technologies: * The bulk of the code makes use of MLIR, which is used to create a high level IR that precisely models the semantics of Python code. Most of the optimizations are done in MLIR, which then gradually lowers it to LLVM * LLVM is used as the backend of the compiler. Once the MLIR optimizer has lowered the code down to a C/C++ Abstraction level, LLVM runs its optimizer to apply low level optimizations and finally emits native machine code for the requested target. The project also makes use of LLVMs excellent, Garbage collection support via statepoints, to support 100% accurate Garbage Collection as well as relocating Garbage Collectors in the future.
Building from Source
Building from Source requires a C++17 Compiler, cmake and the correct version of MLIR, LLVM and LLD.
MLIR is currently a very fast moving project and Pylirs source code tries to closely track tip of the tree. The
required revision tested to build a specific version of pylir is always documented
here.
Pylir requires LLVM, MLIR and LLD to be built at this revision, and then be able to be found via cmake. Via the
CMAKE_PREFIX_PATH variable, one can point cmake at the LLVM and MLIR installation.
Quick tour of the source code
src - Contains all the C++ code making up the compiler
`-pylir
|-CodeGen - Contains the Frontend AST to MLIR generation
|-Diagnostics - Diagnostics Infra used by the Lexer and Parser
|-Interfaces - Common Info used throughout the compiler
|-Lexer - The Python Lexer
|-LLVM - Custom LLVM passes and plugins used mainly for Garbage Collection
|-Main - The main program and driver of the compiler
|-Optimizer - The optimizer utilizing MLIR with Dialect, Transformation Passes, Analysis Passes and Dialect lowering
|-Parser - The Python Parser
|-Runtime - Runtime code linked into the final executable, containing a C++ API to interact with python objects as
| well as support code that implements Exception Handling and Garbage Collection
`-Support - Various utility code and data structures used by the compiler and runtime.
Owner
- Name: Pylir
- Login: Pylir
- Kind: organization
- Repositories: 1
- Profile: https://github.com/Pylir
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: Pylir
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Markus
family-names: Böck
email: markus.boeck02@gmail.com
orcid: 'https://orcid.org/0009-0006-1009-5770'
- given-names: Pylir Contributors
repository-code: 'https://github.com/Pylir/Pylir'
url: 'https://pylir.github.io/Pylir/'
abstract: >-
pylir is an optimizing ahead-of-time compiler for python.
The goal of the project is to compile python code to
native executables that run as fast as possible through
the use of optimizations. Despite being ahead-of-time, the
goal is to achieve as high of language conformance as is
possible and reasonable.
keywords:
- LLVM
- MLIR
- Compilers
- Python
license: Apache-2.0
GitHub Events
Total
- Issues event: 2
- Watch event: 70
- Fork event: 5
Last Year
- Issues event: 2
- Watch event: 70
- Fork event: 5
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- hudengjunai (2)
- zero9178 (1)
Pull Request Authors
- zero9178 (111)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- Chocobo1/setup-ccache-action v1 composite
- actions/setup-python v4 composite
- ilammy/msvc-dev-cmd v1 composite
- lukka/get-cmake latest composite
- msys2/setup-msys2 v2 composite
- docutils >=0.17
- furo ==2022.9.
- myst-parser ==0.18.
- sphinx ==5.3.
- docopt >=0.6.2 test
- lit >=12.0.0 test
- requests >=2.25.1 test
- actions/checkout v3 composite
- ./Pylir/.github/actions/llvm-checkout * composite
- actions/cache/restore v3 composite
- ./Pylir/.github/actions/dependencies * composite
- ./Pylir/.github/actions/llvm-fetch * composite
- actions/checkout v3 composite
- actions/deploy-pages v1 composite
- actions/setup-python v4 composite
- actions/upload-artifact v3 composite
- actions/upload-pages-artifact v1 composite
- ./Pylir/.github/actions/dependencies * composite
- ./Pylir/.github/actions/llvm-checkout * composite
- actions/cache v3 composite
- actions/checkout v3 composite
- ./Pylir/.github/actions/dependencies * composite
- actions/checkout v3 composite