https://github.com/fus3n/cupscript
CupScript Is A Simple Scripting Language Completely Created Using Python
https://github.com/fus3n/cupscript
language programming-language python ruby ruby-like scripting-language
Last synced: 2 months ago
JSON representation
CupScript Is A Simple Scripting Language Completely Created Using Python
- Host: GitHub
- URL: https://github.com/fus3n/cupscript
- Owner: Fus3n
- Created: 2021-11-28T20:00:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-30T14:08:47.000Z (over 2 years ago)
- Last Synced: 2023-05-16T15:24:43.109Z (about 2 years ago)
- Topics: language, programming-language, python, ruby, ruby-like, scripting-language
- Language: Python
- Homepage:
- Size: 151 KB
- Stars: 23
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## CupScript
CupScript is a simple scripting language made using python
It includes some basic functionality like variables, loops, and some other built in functions but it is not a full language.
I made it to learn how programming languages work and how to make a language specifically interpreted languages.**NOTE: This is not meant for general use its just a fun personal project but you're free to try it out or use it if you can**
Heres an installation/run guide if you want to try it out.
# Installation:
git clone https://github.com/Fus3n/cupscript
cd cupscriptthere are no requirements, but you will need python 3.9 or higher to run it.
# Run Scripts/cupshell:
python3 cup.py
python3 cup.pyrun file from cupshell: Run("filename")
# Syntax
Examples can be found in the the [example](https://github.com/Fus3n/cupscript/blob/main/examples) directory.
I will be adding more examples soon.# Features
### Display/Input
```ruby
print("Hello World")
# commentsprint(1 + 2)
print(1 - 2)
print(1 * 2)
print(1 / 2)
print(1 % 2)
print(1 ^ 2)
print((1 + 2) * 3 - 4 / 5 % 6 ^ 7)name = gets("Enter your name: ")
print("Hello " + name)```
### Definitions
```ruby
a = [1, 2, 3, [4, 5, 6]]b = 5
# or
var b = 5c = "Hello World"
b = b + a>0; # 'a>0' -> accesing the first element in the list
d = a>3>0 # accesing the 3rd element and the first element of that list python equivalent: a[3][0]func add(a, b)
return a + b
endfunc add_two(a, b) -> a + b + 2
add_two(5, 5)
```
### Loops
```ruby
# for loop
for i = 0 till 100 do
if i % 3 == 0 and i % 5 == 0 then
print("fizzbuzz")
else if i % 3 == 0 then
print("fizz")
else if i % 5 == 0 then
print("buzz")
else
print(i)
end
end# while loop
i = 0
while i != 5 do
print("Hello! " + tostr(i)) # 'tostr' converts i to string 'toint' does opposite
i = i + 1
end```
Check [example](https://github.com/Fus3n/cupscript/blob/main/examples) folder for more information / Full Overview