Skip to content

Sup2point0/supcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

supcode

prompt.open()
prompt.out("sup world!")

Introduction

Supcode (stylised supcode) is a general-purpose programming language created by Sup#2.0 under 2.0 Studios. It is largely based on Scratch, Python and Wikitext. The current major version is supcode 5.0, with the latest major release being supcode 5.7. supcode 6.0 is currently in development.

supcode 5.0

official name supcode
format text-based
level high-level
execution interpreted
paradigm imperative, object-oriented, event-driven
purpose general-purpose
syntax human-friendly – readable, intuitive, keyword-focused
type dynamic
indentation significant (pre-6.0)
insignificant (post-6.0)
platform any
based on Scratch, Python
inspired by Wikitext Markup, Swift, C#, HTML
filename extensions .sc, .sc6 .sc5, .scx
other extensions .scd, .scp, .scv, .scl, .scs, .scg
main flavour Utinax One
other flavours Veritinax One, Resinax 1.6
initial release September 2021
founder Sup#2.0
developer 2.0 Studios (2.0 Studios LLC)
IDEs supcode Studio, supcode Studio Strium
latest release 5.7 (July 2023)
6.0 (upcoming)

Aims and Improvements

Supcode is designed to be intuitive, readable, and versatile.

As a bridge of sorts between the block-based environment of Scratch and proper text-based programming languages, its structure and syntax are fairly similar.

Supcode comes with powerful customisability and convenient shortcuts. Like Scratch, there is an extensive assortion of extensions, both internal and external, to allow for limitless specialisation and applications.

Files and Applications

Supcode files use the .sc filename extension. Often, this has a number following it to indicate the version number (.sc4, .sc5, etc.). Extensions use the .scx file extension. There are also a several other file extensions for specialised cases, such as .scd or .scv, though these are rarely used.


Specimens

supcode 6.0

Note

supcode 6.0 is currently under development.

<sup ver="6" sty="utinax-vis" ind=3>
\\
DISCLAIMER –
This code is only a peek at what supcode can do.
It is not by any means functional, optimised or perfect.
Enjoy ^v^
\\

<sec 'structs'>
create struct 'profile' {
   \\
      Represents a user profile.
   \\

   evolve action create self(ctx) [
     | int 'id'
     | str 'user', 'name'
     | str, list(str) 'alts' = none
     | list(str) 'langs' = list()
     | list(str) 'apts' = list()
     | (par)s 'pars'
   ] {
      \\
         Creates a new profile.
      \\

      auto set id, name, alt-name, langs, apts

      set self.'render-keywords' = dict(
         "id" = "User ID",
         "name" = "Username",
         "alts" = "Alternative Usernames",
         "langs" = "Programming Languages",
         "apts" = "Aptitudes",
      )

      loop for key, val in pars {
         set self.(shard(key)) = val
      }
   }

   create func self.render-text() to str {
      set 'text' = "Profile[" + "\n"

      loop for 'var' in self._vars_ {
         if var in self.render-keywords {
            alt text + "`render-keywords # var`: "
         } else {
            alt text + str(var) + ": "
         }

         alt text + { if var is iterable then {
            str.join(
               { for each in var out str(each) }
            ) [sep = ", "]
         } else str(var) }
      }

      out text
   }
}
</sec>

<sec "core">
evolve sys.run(ctx) [(par)s]
{
   set 'sup' = profile() [
      | id = 2.0
      | name = "Sup#2.0"
      | alt-name = "Sup2point0"
      | langs = "supcode", "Scratch", "Python", "C#", "HTML", "CSS", "JavaScript",
      | apts = (
         "creating", "designing", "coding", "procrastinating",
      )
   ]

   sys.out(sup.render-text())
   sys.in()
   sys.quit()
}
</sec>

\ how’d you like that?
</sup>

supcode 5.7

\ supcode 5.7

create struct 'SoupMachine' {
  evolve func self.create(ctx) [
    | num 'cost'
    | str 'name' = none
    | (str)s 'flavours' = ()
  ] {
    set self.'cost' = cost
    set self.'name' = { if name then name else ctx.shard.str }
    set self.'flavours' = { loop for each in flavours || case(each)[lower] }
  }
  
  define self.purchase() [
    | source
    | int 'count' = 1
    | pool[self.flavours] 'flavour' = none
  ] {
    if count < 1 {
      evoke "Can’t give that many bowls of soup!"
    }
    
    if not flavour {
      set 'flavour' = random(self.flavours)[option]
    }
    
    alt source - self.cost * count
    func.out("Here’s some flavour` soup!")
  }
}

set 'credits' = 200
set 'soupy' = SoupMachine() [
  | cost = 20
  | flavours = "tomato", "mushroom", "potato"
]

sys.out(soupy.purchase(credits, 1, "mushroom"))

More specimens can be found in specimens.