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
(define fib (lambda (n)
(if (<= n 2)
1
(+ (fib (- n 1)) (fib (- n 2))))))
(write (fib 9)) ; outputs `34`
;;; Hello, world
;; ...done three ways
; Write to std out
(write "Hello, world!")
; Create a file and write to it
(define f (file-create "hello.txt"))
(if f (begin
(write "Hello, world!" f)
(close f)))
; Write to a tcp connection
(define conn (net-conn "example.com" "80"))
(if conn (begin
(write "Hello, world!\r\n" conn)
(close f)))))
; Open a file for reading
(define f (file-open-read "error.log"))
; Throw an error if it cannot be read
(if (not f) (! "Could not open file"))
; Print all lines that start with "DEBUG"
(apply display-lines
(filter
(lambda (line)
(regex-match? "^DEBUG" line))
(read-all-lines f)))
; Close the file
(close f)
slope
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.
slp
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)
slc
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.