- Introduction
- Installation
- Execution (Installation via
pip
) - Execution (Installation from source)
- Test Your Installation
- Debugging
- Suppressing Warnings
- Contributing
- I found a bug!!!
- Syntax Highlighting
- Learn SunSip: Refer to the Wiki
- Research
- Trailer
- About Me
SunSip, SLWNSNBP, or Simple Language Which Name Shall Not Be Pronounced, is a Turing Complete, Practical, Whitespace Insignificant,
Simple programming language (which name shall not be pronouced). SunSip is based on variables, with a simple concept and syntax,
designed to be beginner friendly. There are goals to turn it into a golfing language (by shortening instructions, et cetera.,) but that
is currently just a thought. The slogan is, 800 lines of code, for a good coding experience
. This is a project that I am working on
in order to apply for a certain science club. You can refer to the Research
section for details.
First, you have to install python via python.org. You might already have it installed, or you might not.
SunSip can be installed from source or via pip
. To install SunSip via pip
, use:
pip install SunSip
Or whatever way you use pip
.
SunSip code can be named with any extension, although the preferred extension is either none, .txt
, .sunsip
, .snsp
, or .slwnsnbp
.
After writing the SunSip code, you can execute it using
sunsip path-to-program [options]
For a list of options, refer to the help menu accessible via python -m SunSip --help
.
To install SunSip from source:
- Clone this repository
- Make sure you have Poetry installed
- Run
poetry install
in the cloned repository
You can then run sunsip
and sunsip-syntax-highlight
as normal.
If you haven't installed SunSip, do so by referring to the Installation Section.
First, create a folder on your desktop called hellosnsp
. This folder will store all of your programs.
Create a text file named firstprogram.txt
inside the folder, and write:
comment this should print hello world
set to "Hello, World! "
out
Execute the file (see the Execution Sections). It should produce the output:
Hello, World!
If you need to debug your code, use the -d
flag. This will output the parsed program first:
Program:
[['#', 'math support'], ['', ''], ['set', '180 to 180'], ['set', '5 to 5'], ['set', '4 to 4'], ['set', '1 to 1'], ['set', 'number to 1'], ['set', 'to "'], ['out', ''], ['set', 'empty to " "'], ['', ''], ['set', 'to "'], ['calc', 'type number'], ['calc', 'type last number'], ['set', 'length to'], ['calc', 'subtraction 5 length'], ['set', 'i to'], ['set', 'stack to []'], ['calc', 'push stack number'], ['set', 'stack to last'], ['', ''], ['calc', 'push stack empty'], ['set', 'stack to last'], ['calc', 'subtraction i 1'], ['set', 'i to'], ['calc', 'less i 1'], ['calc', 'multiplication last 4'], ['skip', ''], ['', ''], ['set', 'to 10'], ['back', ''], ['', ''], ['calc', 'factorial number'], ['calc', 'push stack last'], ['set', 'stack to'], ['set', 'to "'], ['calc', 'join stack'], ['out', ''], ['calc', 'addition number 1'], ['set', 'number to'], ['set', 'to 40'], ['calc', 'greater number last'], ['calc', 'multiplication last 4'], ['skip', ''], ['', ''], ['set', 'to 36'], ['back', ''], ['', ''], ['set', 'to "'], ['out', '']]
and after each line will print the current line, current instruction, current parameters, and current variable values.
Current Line: 49
Instruction: out
Parameters:
Variables: {'180': 180, 'last': '', '5': 5, '4': 4, '1': 1, 'number': 41, 'empty': ' ', 'length': 2, 'i': 0, 'stack': [40, ' ', ' ', ' ', 815915283247897734345611269596115894272000000000]}
Take the example program,
# math support
set 180 to 180
set 5 to 5
set 4 to 4
set 1 to 1
set number to 1
set to "
out
set empty to " "
set to "
calc type number
calc type last number
set length to
calc subtraction 5 length
set i to
set stack to []
calc push stack number
set stack to last
calc push stack empty
set stack to last
calc subtraction i 1
set i to
calc less i 1
calc multiplication last 4
skip
set to 10
back
calc factorial number
calc push stack last
set stack to
set to "
calc join stack
out
calc addition number 1
set number to
set to 40
calc greater number last
calc multiplication last 4
skip
set to 36
back
set to "
out
When you execute it, it will cause warnings, and output the following:
WARNING: UNEXP LINE 1
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
1 1
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
2 2
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
3 6
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
4 24
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
5 120
WARNING: IMPL TYPE CONV AT LINE 37
WARNING: IMPL TYPE CONV AT LINE 37
<snip>
(with warnings in red.) Warnings are parts where your program could've gone wrong. To suppress them, for cleaner output, use the -w
flag:
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800
11 39916800
12 479001600
13 6227020800
14 87178291200
15 1307674368000
16 20922789888000
17 355687428096000
18 6402373705728000
19 121645100408832000
20 2432902008176640000
21 51090942171709440000
22 1124000727777607680000
23 25852016738884976640000
24 620448401733239439360000
25 15511210043330985984000000
26 403291461126605635584000000
27 10888869450418352160768000000
28 304888344611713860501504000000
29 8841761993739701954543616000000
30 265252859812191058636308480000000
31 8222838654177922817725562880000000
32 263130836933693530167218012160000000
33 8683317618811886495518194401280000000
34 295232799039604140847618609643520000000
35 10333147966386144929666651337523200000000
36 371993326789901217467999448150835200000000
37 13763753091226345046315979581580902400000000
38 523022617466601111760007224100074291200000000
39 20397882081197443358640281739902897356800000000
40 815915283247897734345611269596115894272000000000
It is not recommended to turn off warnings while debugging.
I want to contribute! How?
Method 1, create a pull request. Method 2, edit directly. Method 3, open an issue.
We accept contributions that add functionality, fixxes bugs, or raises bugs. However, code editors must create a pull request or open an issue, and the issue must be passed before they do the editting.
If your code implies a bug, please explicitly paste the output, warnings, and debuggings.
See Contributing.
Simply run:
sunsip-syntax-highlight path-to-program
As I have said, this is a research project.