Skip to content

CrazyProger1/FastPy

Repository files navigation

FastPy

FastPy is a statically typed programming language with pythonic syntax.

About

FastPy is a new general purpose, multi-paradigm, high performance, statically typed programming language which have pytonic intuitive syntax.

Examples

# Just a comment :D

log('Hello, World!')  # print hello world
interface Car:
    public:
        fun __init__(name: str, weight: int): ...
		
		
        @property
        fun brand() -> str: ...
			
		
        @property
        fun name() -> str: ...
			
			
        @property
        fun weight() -> int: ...
		

class Tesla(Car): # Car implementation
    private:
        __name: str
        __weight: int
    public:
        fun __init__(name: str, weight: int):
            __name = name
            __weight = weight
		
		
        @property
        fun brand() -> str:
            return 'Tesla'
			
		
        @property
        fun name() -> str:
            return __name
			
			
        @property
        fun weight() -> int:
            return __weight



fun car_factory(car_brand: str, name: str, weight: int) -> Car:
    match car_brand:
        case "Tesla":
            return Tesla(name, weight)
        default:
            return null


some_car: Car = car_factory("Tesla", "Model X", 2301) 
log(some_car.name) # Model X
log(some_car.weight) # 2301

*For more samples, see examples directory.

Features

  • Transpailable to C++. Therefore, compiled. Therefore, fast
  • Easy intuitive syntax, similar to Python
  • Statically typed
  • Easy expandable
  • Flexible, you can customize it for yourself or completely rewrite each component
  • Built-in logging system

Customizing

That language is built in such a way that allows to support customizing at every stage of transpiling or interpreting. For more info, see customizing doc file.

Highlighting

To enable syntax highlighting, see highlighting doc file.

Requirements

To transpile and compile your program, you need to install the requirements.

Windows

  1. First, you need to install Python 3.10
  2. Then install some libs:
pip install -r requirements.txt
  1. Next, you need to install MinGW (optional, only used for compilation)

Transpiling

Usage:

python main.py [-h] -s SOURCE [-t] [-o OUTPUT] [-c]

Examples:

  • Transpile file main.fpy to C++ and save to some_folder/src:
python main.py -s main.fpy -t -o some_folder
  • Transpile file main.fpy to C++ and save to some_folder/src and compile:
python main.py -s main.fpy -t -c -o some_folder

First run from IDE (script: file):

First run from IDE

TODO

The entire list of completed and scheduled tasks is available in the TODO file.

Contributors

Status

Project frozen until studying end :(

Licence

FastPy uses the MIT license. See the bundled LICENSE file for details.