Skip to main content

REPL of a simple, interpreted and statically-typed programming language.

Project description

Banner


Vadi is a simple, interpreted and dynamically-typed programming language. It comes with its own tool called a REPL, which lets you try out code quickly.

The interpreter which is the part of Vadi that runs your code, uses a technique named "Recursive Descent Parsing." This technique helps the interpreter understand your high-level code by creating a data-structure called a parse tree. Then, the interpreter uses this parse tree to figure out what your code is asking it to do.You can check out the Vadi's Syntax Grammar in BNF for more information.

Installation

Use pip or pipx to install vadi's REPL.

[!TIP] The pipx package installer is strongly recommend for installing vadi on a global level to avoid conflicts.

pipx install vadi

OR

pip install vadi

Now, run the REPL.

vadi

Grammar

The grammar is written in BNF(Backus Naur Form) notation.

<Interpreter> ::= <binary_expression>
                | <unary_expression>
                | <statement>
                | <expression>
                | <VAR>
                | <FLT>
                | <INT>

<binary_expression> ::= <expression> "+" <expression>
                      | <expression> "-" <expression>
                      | <expression> "*" <expression>
                      | <expression> "/" <expression>
                      | <expression> "=" <expression>

<unary_expression> ::= "+" <expression>
                     | "-" <expression>

<statement> ::= "DECL" <variable> "=" <expression>

<expression> ::= <term> "+" <term>
               | <term> "-" <term>

<term> ::= <factor> "*" <factor>
         | <factor> "/" <factor>

<factor> ::= "INT"
           | "FLT"
           | "(" <expression> ")"
           | <VAR>

Syntax

  • Unary operations

    +1
    -5
    
  • Binary operations

    56+23
    
  • Complex arithmetic operations

    1*2(4+5(5/6))
    
  • Variable declarations

    var int = 89;
    var float = 3.1415;
    var difference = int - 20;
    
  • Conditionals: if-else

    TODO: issue#2

  • Conditionals: loops

    TODO: issue#2

Supported datatypes

  • Integer
  • Float

Contributing

Issues and Pull Requests are definitely welcome! Check out Contributing guidelines to get started. Everyone who interacts with the vadi project via codebase, issue tracker, chat rooms, or otherwise is expected to follow the Code of Conduct.

License

This project is licensed under the MIT License. See the LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vadi-0.0.7.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vadi-0.0.7-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file vadi-0.0.7.tar.gz.

File metadata

  • Download URL: vadi-0.0.7.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

File hashes

Hashes for vadi-0.0.7.tar.gz
Algorithm Hash digest
SHA256 221a3b0cb69f6583c1f07d9902be824eefd35fa3ff0f68a318c18320371ee26f
MD5 e30d89355714cf164d7acd40d8a5771a
BLAKE2b-256 0bce18c4e5c22863f6d3d30290bdc834ae84b8c1d3dd636cffe95687068cda70

See more details on using hashes here.

File details

Details for the file vadi-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: vadi-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

File hashes

Hashes for vadi-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f2ba453a06cdbb95ed64a5b5e6eaa3c275f3cc9a2fc1feb7a07dc877b8b5ee9b
MD5 5a2275e63e689d495cdc4cf9262e0284
BLAKE2b-256 244520f1445b8221849509405c17d53a5a72e3ed6a3376a1a496dfa22251aa90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page