gsp

The gsp compiler.

  • Owner: gsp-lang/gsp
  • Platform:
  • License:: Other
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Gsp

Gsp is a compiler built on top of Joseph Adams' Gisp.
Gsp provides a more complete language environment, including Golang bindings
and the Gsp Prelude.

Install

go get github.com/gsp-lang/gsp
cd <GOPATH>/src/github.com/gsp-lang/gsp
go build
echo 'export PATH=$PATH:"${pwd}"' >> ~/.profile
. ~/.bashrc # . ~/.zshrc

Build Prelude

cd <GOPATH>/src/github.com/gsp-lang/stdlib/prelude
gsp prelude.gsp > prelude.go

Example

; Copy into example.gsp
(ns main
    "/fmt"
    "/net/http")

(def hello (fn [w r]
    (fmt/fprintf w "hello")
    ()))

(def main (fn []
    (http/handle-func "/" hello)
    (http/listen-and-serve ":9090" nil)))

To compile & run

gspc example.gsp
./bin/main

Using the Prelude

(ns main
	"/fmt")

(def main (fn []
    (let 
        (fmt/println (/car (/cons 1 /null)))
        (fmt/println (/len (/cons 1 /null)))
        (fmt/println (/car (/map (fn [x] (+ x 20)) m)) (/car m))
        (fmt/println (/len m))
        (fmt/println (/car (/cons 17 m)))
        (fmt/println [1 2 3 4])
        (fmt/println (/car (/cdr (/cdr (/append m (/cdr m))))))
        ())))

More examples

Check out the Prelude. It is written in Gsp.

License

Originally licensed code can be found at https://github.com/jcla1/gisp.

MIT

Main metrics

Overview
Name With Ownergsp-lang/gsp
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:Other
所有者活动
Created At2015-09-27 14:28:38
Pushed At2015-09-30 18:41:40
Last Commit At2015-09-30 12:41:10
Release Count0
用户参与
Stargazers Count177
Watchers Count5
Fork Count4
Commits Count19
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private