Skip to content
This repository has been archived by the owner on Apr 20, 2020. It is now read-only.
/ viper Public archive

[WIP] A Pythonesque language with a design that focuses on efficiency and expressiveness. Compiles to WebAssembly

License

Notifications You must be signed in to change notification settings

appcypher/viper

Repository files navigation

Moved project into Raccoon

VIPER

INTRODUCTION

Viper is a language with Python 3.x syntax that is amenable to static analysis. The repository both defines the spec of the language and contains a reference implementation of the compiler, which compiles a legal Viper code to WebAssembly.

Viper will not maintain complete syntactic and semantic compatibility with Python. Several dynamic elements known of Python are not available in Viper. For example, Viper doesn't have runtime module modification.

There are other similarly oriented projects, but they are all objectively different from Viper.

MicroPython is a well-optimized Python interpreter (with some JIT support) while Nuitka compiles Python to C. These two projects still allow dynamic aspects of Python, which means their performances may suffer from those parts.

Vyper (not to be mistaken for Viper) primarily targets Ethereum VM and not designed for general-purpose programming.

Also unlike Nim, Boo and Cobra, Viper tries to stick to Python syntax and semantics as much as possible and wherever it makes sense.

RPython is quite similar to this project, but the developers have made it clear that their goal is not to make RPython a standalone language.

SETTING UP THE PROJECT

REQUIREMENTS
STEPS
  • Clone project

    git clone https://www.github.com/appcypher/viper.git
  • Move to project's directory

    cd viper
  • Install dependencies

    pipenv install
  • Build the project [macOS and Linux]

    sh build.sh setup
  • Compile and run sample viper code [WIP]

    viper samples/class.vi

TESTING

REQUIREMENTS
STEPS
  • You can run all the tests in a single command.
    pipenv run pytest

USAGE

  • Show help info

    viper --help
  • Compile and execute a Viper source file [WIP]

    viper samples/class.vi

LANGUAGE DESIGN

Viper is similar to Python in a lot of ways, but being a statically-typed language, it made some trade-offs to ensure predictable performance. In this respect, Viper is not always compatible with Python.

Viper's type system is also similar to Python's although it is a bit more fleshed out. While Viper prioritizes a design that benefits static analysis, it still allows Python's level of flexibility where statically determinable. This is why type inference and structural typing are an important part of Viper.

For more details, check NOTES.md

LICENSE

Apache License 2.0

Attributions can be found here

About

[WIP] A Pythonesque language with a design that focuses on efficiency and expressiveness. Compiles to WebAssembly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published