Skip to content

Vohulang A Programming Language Based On Rust Language

License

Notifications You must be signed in to change notification settings

houshmand-2005/vohulang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vohulang

A programming language based on Rust language

vohulang_poster

Table of Contents

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 | vohulang for Windows

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

Or run from files, like this sample test square_area.vo:

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

Samples

sample programs:

Commands

[START]

[START]

This means that you start the program

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

[S! name] > ("Houshmand")

You can insert string values like this
N! means the content is Integer

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

[N! number1] > (5)

You can insert number in values like this
S! means the content is string

[PS! ...]

[PS! number1]

output:
5

You can show the variable with PS!
PS! means print data into string

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

[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! ...)

[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)

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

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

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

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

[+! 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]

[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 ) :

cargo build --release

Changes

  • version 0.1.1 : interpreter mode add to the program