All Projects → adamsol → Pyxell

adamsol / Pyxell

Licence: MIT license
Multi-paradigm programming language compiled to C++, written in Python.

Programming Languages

python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Pyxell

nerus
Large silver standart Russian corpus with NER, morphology and syntax markup
Stars: ✭ 47 (+11.9%)
Mutual labels:  syntax
evil-textobj-syntax
This package is a port of vim-textobj-syntax for emacs. It provides evil text objects for consecutive items with same syntax highlight.
Stars: ✭ 19 (-54.76%)
Mutual labels:  syntax
stack
🥭 nxpm-stack lets you generate a complete and opinionated full-stack application in a Nx Workspace, ready to extend and deploy!
Stars: ✭ 98 (+133.33%)
Mutual labels:  generators
sublime-pine
A Pine programming language syntax for Sublime Text.
Stars: ✭ 35 (-16.67%)
Mutual labels:  syntax
postcss-styled
PostCSS syntax for parsing styled components
Stars: ✭ 53 (+26.19%)
Mutual labels:  syntax
sinator
Sinatra application generator
Stars: ✭ 19 (-54.76%)
Mutual labels:  generators
LuaExtended
An improved ST3 Lua syntax definition.
Stars: ✭ 19 (-54.76%)
Mutual labels:  indentation
vscode-blockman
VSCode extension to highlight nested code blocks
Stars: ✭ 233 (+454.76%)
Mutual labels:  indentation
jsdoc-syntax.vim
Standalone JSDoc syntax for vim
Stars: ✭ 17 (-59.52%)
Mutual labels:  syntax
coding-notes
I'm compiling comprehensive coding tutorials for many different languages and frameworks! 🐲
Stars: ✭ 201 (+378.57%)
Mutual labels:  syntax
frog
Frog is an integration of memory-based natural language processing (NLP) modules developed for Dutch. All NLP modules are based on Timbl, the Tilburg memory-based learning software package.
Stars: ✭ 70 (+66.67%)
Mutual labels:  syntax
ninja-ui-syntax
Beautiful Atom syntax theme inspired by a Dribbble shot.
Stars: ✭ 17 (-59.52%)
Mutual labels:  syntax
odinson
Odinson is a powerful and highly optimized open-source framework for rule-based information extraction. Odinson couples a simple, yet powerful pattern language that can operate over multiple representations of text, with a runtime system that operates in near real time.
Stars: ✭ 59 (+40.48%)
Mutual labels:  syntax
ohmyguard
Binary patten matching style syntax for erlang function guards
Stars: ✭ 17 (-59.52%)
Mutual labels:  syntax
CodeEditorView
Code Editor UITextView
Stars: ✭ 20 (-52.38%)
Mutual labels:  syntax
vscode-liquid
💧Liquid language support for VS Code
Stars: ✭ 137 (+226.19%)
Mutual labels:  syntax
set-syntax
An Atom package that creates easy Command Palette commands for setting the syntax of the current file
Stars: ✭ 24 (-42.86%)
Mutual labels:  syntax
oceanic-next-vim
Oceanic Next colorscheme for vim
Stars: ✭ 49 (+16.67%)
Mutual labels:  syntax
mapgen
map generator stuff
Stars: ✭ 26 (-38.1%)
Mutual labels:  generators
unindent
Report code that is unnecessarily indented
Stars: ✭ 18 (-57.14%)
Mutual labels:  indentation

Pyxell

Clean and easy-to-use multi-paradigm programming language with static typing.

Documentation

https://www.pyxell.org/docs/

Examples | Playground

Motivation

Pyxell [pixel] aims to combine the best features of different programming languages, pack them into a clean and consistent syntax, and provide the execution speed of native machine code.

It draws mainly from Python, C++, C#, and Haskell, trying to avoid common design flaws that have been nicely described in this blog post.

Features

  • Indentation-based syntax
  • Strongly static typing with partial type inference
  • 64-bit integers and double-precision floating-point numbers
  • Arbitrary-precision rational numbers
  • Immutable strings
  • String interpolation
  • Mutable containers: array, set, dictionary
  • Array/string slicing
  • Complex for-loops with ranges, steps, and zipping
  • Array/set/dictionary comprehension
  • Native tuples
  • First-class functions
  • Default, named, and variadic function arguments
  • Lambda expressions
  • Generic functions
  • Generators
  • Classes with safe references
  • Inheritance and virtual methods
  • Nullable types
  • Full transpilation to C++ and compilation to machine code
  • Automatic memory management (utilizing C++'s smart pointers)

To do:

  • Exception handling
  • Static class fields and methods
  • Complex numbers
  • Unicode support
  • Module system
  • Multiple inheritance
  • Generic classes
  • Operator overloading
  • Asynchronous programming

Dependencies

  • Python 3.6+

  • C++17 compiler: GCC 7+ or Clang 5+

Usage

python pyxell.py program.px

If the program is valid, program.cpp file and program.exe executable will be created in the same folder, and it will be automatically executed (unless you add the -n flag). Otherwise, errors will be displayed, pointing to the erroneous code location.

By default, gcc command is used to compile the code. You can pick a different compiler using the -c parameter.

The executable is not optimized by default. You can set an optimization level with the -O parameter, e.g. -O2. This will make the program run faster, but also make the compilation slower.

In order to speed up the compilation, you can precompile the C++ header (lib/base.hpp) by first running the script with the -p flag. Note that the precompiled header is compatible only with the same C++ compiler, optimization level, and Pyxell version.

Use -s to skip the compilation step and obtain transpiled C++ code with all headers included, ready for manual compilation (with -std=c++17).

To see all command line options, use -h.

Testing

pip install -r test/requirements.txt
python test.py

Tests are divided into good (supposed to compile and run properly) and bad (should throw compilation errors).

By default, the whole C++ code for valid tests is merged, so that only one file is compiled, which is faster than compiling hundreds of files individually, even using multiple threads. Total execution time (with default settings) should be around 30-60 seconds.

If, however, the script fails with an error like this: too many sections / file too big (seen with GCC 7.2 on Windows), or there is another compilation error that is hard to decipher, then you might need to add the -s flag so that each test is compiled separately.

You can pass a path pattern to run only selected tests (e.g. python test.py arrays).

Documentation

To build the documentation from source, go to the docs folder, run npm install, then make. To start a documentation server locally, run pip install -r requirements.txt and python server.py in the same folder.

PyInstaller

You can build a standalone compiler application using PyInstaller. Install PyInstaller with pip, then run make exe. An executable (not requiring Python to run) will be created in the dist/pyxell folder.

Alternatives

There are only a few languages with indentation-based syntax. Some more or less similar to Pyxell are, in alphabetical order:

  • Boo (based on .NET),
  • CoffeeScript (transpiled to JS),
  • F# (functional, based on .NET),
  • Genie (compiled via C),
  • Haskell (functional, compiled),
  • Nim (compiled via C/C++ or transpiled to JS),
  • Python (dynamically typed).

History

  • The project was originaly written in Haskell, with BNFC as the parser generator, and used LLVM as the target language.
  • In version 0.7.0, the code was rewritten to Python, with ANTLR as the parser generator.
  • In version 0.9.0, the project was refactored to use C++ as the target language.
  • In version 0.12.0, a new parser was implemented to replace the one generated by ANTLR (due to performance reasons).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].