1

A hackable hobby programming language

 2 years ago
source link: https://slope.colorfield.space/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

slope: home

slope

A hackable hobby programming language and toolset for having fun and making cool things

  • High Level
  • Dynamically Typed
  • Lexically Scoped
  • Hackable
  • Portable
  • Easy To Learn
  • Functional
  • MIT Licensed
Code example:

(define fib (lambda (n)
    (if (<= n 2)
        1
        (+ (fib (- n 1)) (fib (- n 2))))))

(write (fib 9)) ; outputs `34`
              





( )


(  ( ))
( f (
  (  f)
  ( f)))


(  (  ))
( conn (
  (  conn)
  ( f)))))
              


(  ( ))


( ( f) (! ))


( display-lines
  (
    ( (line)
      (  line))
    ( f)))


( f)
              
Check out the git organization. gitea.svg

interpreter.pngslope

The slope interpreter is the main application to run slope code. It runs files, one liners, and acts as a REPL.

The REPL comes with:

  • Tab completion
  • Readline-style line editing
  • Dynamic procedure help via the usage procedure

The interpreter can also preload files from a defined preload directory to quickly get your environment set up the way you want it every time.

package-manager.pngslp

slp is a custom package management system for the slope ecosystem. It manages your slope modules folder for you and can also manage global installs of modules.

The following opperations are available:

  • install
  • remove
  • update
  • list (shows all known modules)
  • search
  • show (view module details)
  • installed (lists currently installed modules)
  • gen (generate a new module)

compiler.pngslc

slc freezes slope programs into single executable files. It does this by compiling the slope runtime and embedding a linked version of the slope source code into it. As such it is a sort of shortcut to compiled programs. Since the whole slope toolset is built in golang this approach does have the benefit of a regularly updated parent compiler and lots of cross-platform support. slc can even leverage this to cross-compile to other architechtures and operating systems.

This is presently an experimental program. It works well in most tested code, but your mileage may vary. Eventually the goal is to write an actual slope to golang source to source compiler. For now slc fills the gap very nicely to provide cross platform executable binaries.

Resources


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK