An open API service indexing awesome lists of open source software.

https://github.com/houshmand-2005/vohulang

Vohulang A Programming Language Based On Rust Language
https://github.com/houshmand-2005/vohulang

language parser rust

Last synced: 29 days ago
JSON representation

Vohulang A Programming Language Based On Rust Language

Awesome Lists containing this project

README

          






Vohulang

A programming language based on Rust language



vohulang_poster

## Table of Contents

- [Overview](#overview)
- [Why using Vohulang?](#why-using-vohulang)
- [Features](#features)
- [How to run?](#how-to-run)
- [Samples](#samples)
- [Commands](#commands)
- [Compile guide](#compile-guide)

# Overview

This is a programming language based on the Rust language, in fact, it reads the program commands line by line and executes them on the Rust

## Why using Vohulang?

Vohulang is an interpreter language, but not a complete programming language, I made this project to learn the Rust language

### Features

- Support **String** type
- Support **Integer** type
- Support **For loops**
- Support **Mathematical operations** such as addition, subtraction, multiplication and division
- Support **Print values**
- Support **Input data from users**
- **And more soon**

# How to run?

First, download the executable file of the program from here : [vohulang for Linux](https://github.com/houshmand-2005/vohulang/releases/download/v0.1.1/vohulang)
| [vohulang for Windows](https://github.com/houshmand-2005/vohulang/releases/download/v0.1.1/vohulang.exe)

```bash
➜ ./vohulang
Vohulang (V0.1.1)
>>> [S! hello] > ("Hello World")
>>> [PS! hello]
Hello World
>>>
```

Or run from files, like this sample test [square_area.vo](samples/square_area.vo):

```bash
➜ ./vohulang samples/square_area.vo
-----Square Area-----
Enter the length of one side :
20
The area is equal to :
400
------- done --------
```

# Samples

sample programs:

- Program to get square area [square_area](samples/square_area.vo)

- Test program for all language operations [all_commands](samples/all_commands.vo)

# Commands

`[START]`

```bash
[START]
```

**This means that you start the program**

`[S! ...] > ("...")`

```bash
[S! name] > ("Houshmand")
```

**You can insert string values like this**

N! means the content is Integer

`[N! ...] > (...)`

```bash
[N! number1] > (5)
```

**You can insert number in values like this**

S! means the content is string

`[PS! ...]`

```bash
[PS! number1]

output:
5
```

**You can show the variable with PS!**

PS! means print data into string

`[INP! ...] > (S! ...)`

```bash
[INP! name1] > (S! enter you name : )
output:
enter you name :

```

**You can get the string values from user with INP!**

data will be stored in name1 variable [INP! **name1**]

`[FOR! ...] > (PS! ...)`

```bash
[S! split] > ("Hi im just a simple loop")
[FOR! 2] > (PS! split)
output:
'Hi im just a simple loop'
'Hi im just a simple loop'
```

**You can make loops with FOR!**

This loop will continue to the number you announce here [FOR! **2**]

And the operation you declare here will be done (**PS!** split)

`[+! ...] > (... + ...)`

`[-! ...] > (... - ...)`

`[*! ...] > (... * ...)`

`[/! ...] > (... / ...)`

```bash
[+! result] > (number1 + 150 + 1)
[PS! result]
output:
156

[-! result1] > (12 - 1)
[PS! result]
output:
11

[*! mul] > (3 * number1)
[PS! mul]
output:
15

[/! newnumber] > (20 / 2)
[PS! newnumber]
output:
10
```

**Mathematical operations of addition, subtraction, multiplication, division**

Specify the operation : [**+!** result]

Specify the name of the output variable of the operation : [+! **result**]

Specify variables or numbers to perform the operation : [+! result] > (**number1 + 2 + 10**)

`[END]`

```bash
[END]
```

**This means that you end the program**


# Compile guide

At first you need install Rust and Cargo
you can do it by this tutorial Install Rust
then you can build and compile this project (in release mode ) :

```bash
cargo build --release
```

## Changes

- **version 0.1.1 :** interpreter mode add to the program