Skip to content

linux-dev-arch/cherryscript

Repository files navigation

cherryscript

A very simple to learn programming language

Note this is just a proof of concept.A fun hobby if you will :D

current progress

  • print - used to display text(no need for double quotes or paranthesis)
  • jump - used to execute a line.
  • start - used to begin main block of code (this is required)
  • end - used to end the main block of code (this is required)
  • loop - used to execute a line a given number of times
  • add - used to add two numbers
  • sub - used to subtract two numbers
  • mul - used to multiply two values
  • div - used to divide two numbers
  • var - used to create a variable
  • assign - used to assign or change a variable value
  • inc - used to increment an integer variable
  • import - used to import a file (still in testing!)
  • exec - used to run a line in an imported file (still in testing)
  • input - used to recive data from the user
  • labels - it is equivalent to a python function

if anyone wants to help me in the development please let me know in github issues

How to use

To run a .ci file just download the interpreter i.e cherryscript.py.

make a .ci file in the same folder as the interpreter

run the following command in the terminal(linux) or command prompt(windows)

For windows

python3.exe cherryscript.py "your program.ci"

without quotes of course

For linux

python3 cherryscript.py "your program.ci"

without quotes of course

General instructions

You can use '// ' for comments

Variables always start with a '$'

Dont forget to specify int for numbers or str for words

You can store the result of a math command in a variable by putting a variable's name after it

loop can be used to run lines after 'end'

Note:choose cherryscript-rolling to try out the latest features

## Syntax

print

print *text*

you can also place variables in between normal text

jump

jump *line_number*

line_number is the actual line number in your text editor

start

start

just put it where you want to start the main code

end

end

use it to end main code section

loop

loop *start_line_number* *end_line_number* *iterations*

iterations is the number of times the code between start line numbers and end line numbers is executed

add

add *first number* *second number* *variable(optional)*

if variable is not given then the result is printed by default

if variable is given then the result is stored in it

sub

sub *first number* *second number* *variable(optional)*

if variable is not given then the result is printed

if variable is given then the result is stored in it

mul

mul *first number* *second number* *optional variable*

similar to add and sub but it does multiplication

div

dv *first number* *second number* *optional variable*

similar to add , sub and mul bit does division

var

var *variable type* *variable name* *(optional)value*

variable type has two values str for string and int for integer

variable names should always start with a $

for example $num

assign

used to assign a value to a variable during execution

assign *variable name* *value*

inc

used to increment an integer type variable by a specified value

inc *variable name* *value*

note that value should always be an integer

NOTE:The following features are still in development

import

used to import a .ci file

import *file name*

exec

used to run a line in an imported file

exec *line number*

labels

initalisation

lables are like the cherryscript equivalent of functions

you can declare a new label before start

the synatx is as below

:lable_name

your code

;

every lable is ended with a ;

executing a lable

any label can be executed by just writing the label name without : in between start and end

or executed using either loop or jump

About

A very simple to learn programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages