Discuss Scratch

skies_shaper
Scratcher
31 posts

SAPLING (programming language) program archive

Hello everyone!
I am the creator of SAPLING (Scratch Application Programming Language (It's Not Great)) ('It' in this case refers to the acronym, the language works pretty well!))
Here is a happy little discussion thread in which you can put your programs, or check out other people's programs!

Project link: https://scratch.mit.edu/projects/884272995/

A short note on SAPLING
The SAPLING interpreter has more or less all of the features Scratch does, as well as
  • multi-dimensional lists
  • objects (which can go in sajd lists)
  • fuctions with return statements
  • various other variable things (incrementation, decrementation)
  • A fully functioning command-prompt-esque thing!
SAPLING is mainly used to manipulate data, however, with SpriteControl (https://scratch.mit.edu/projects/884275352/), you can also make other sprites do as you wish, giving SAPLING interoperability with clones and so forth!
Try it out today!
Tutorial: https://scratch.mit.edu/discuss/topic/735778/

Last edited by skies_shaper (Jan. 18, 2024 04:20:26)

skies_shaper
Scratcher
31 posts

SAPLING (programming language) program archive

To kick things off, here's a basic hello world program!
myprogram.sapi:⮑@console⮑println("hello, world!")

Last edited by skies_shaper (Jan. 16, 2024 21:45:21)

skies_shaper
Scratcher
31 posts

SAPLING (programming language) program archive

Hello!
I have made a little math library of sorts!
math.sapi:⮑@library⮑function logb(base,number)⮑return(ln([number])/ln([base]))⮑endflogb⮑⮑function rad(deg)⮑return([deg]/180*pi())⮑endfrad⮑⮑function deg(rad)⮑return([rad]/pi()*180)⮑endfdeg⮑⮑function inc(num)⮑return([num]+1)⮑endfinc⮑⮑function dec(num)⮑return([num]+1)⮑endfdec⮑⮑function sgn(num)⮑println([num])⮑if([num]>0)⮑return(1)⮑endif⮑if([num]<0)⮑return(-1)⮑endif⮑if([num]=0)⮑return(0)⮑endif⮑endfsgn⮑⮑function trunc(num,dpts)⮑var p⮑p =posof(".",[num])⮑return(concat(substring([num],1,[p]),substring([num],[p]+1,[p]+[dpts])))⮑endftrunc
Just to add some functions I didn't feel like adding to the main interpreter necessarily, and weren't too hard to implement in SAPLING (about the same complexity as in scratch), so here ya go!
skies_shaper
Scratcher
31 posts

SAPLING (programming language) program archive

Have you ever really needed to know the factorial of a number, but all you had to figure it out was a web browser on a computer with internet access, and you were completely stumped as to where to go next? Look no further than this SAPLING program!
factorial.sapi:⮑@console⮑input("number to facorializeificate: ")⮑println(concat(response()," factorialed: ",factorial(response())))⮑⮑function factorial(number)⮑var result⮑result = [number]⮑for([number]-1)⮑result *= [number]-iteration()⮑end⮑return([result])⮑endffactorial

Powered by DjangoBB