0.2.2 • Published 4 years ago

clar v0.2.2

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

Clarence

Clarence is a dynamic, embeddable scripting-language. It's syntax are highly inspired by Clojure. However, it features aweful new modifications on it's vm. With Clarence, you're allowed to write code, that even writes code for you! The entire core (vm, parser, interpreter, bytecode) is pretty small. It was implemented using artesian ECMAscript 16 (JavaScript).

Clarence features a fast dynamic bytecode compilation. Similar to Just in Time compilations. You can use it for scientific computations, embeds of large projects and much much more... It's vm is written in Clarence itselfes so it got self-hosted. That's quite nice, cause while compilation, you are allowed to get some parallel compilations using macros!

Sounds great? So take a look in the samples directory or get even an Installer for Clarence!

Install


As already said, Clarence is implemented in JS so install it's module from NPM:

$ git clone https://github.com/clarence-lang/clarence.git
$ cd clarence
$ npm install clar

Done!

Running programs


You can run your programs like this:

Note: this is an executed example using the samples\simple directory!

cd simple
node run <yourFile.clr>
# or do that:
node run hello.clr

Style


Sample stylish clarence apps:

(ns web.server)

(def http (js/require "http"))

(defn handler [request]
    { :status 200
        :headers { "Content-type" "text/html" }
        :body "Hello, World!" })
        
(defn process [req res handler]
    (let [response (handler req)
          status (get response :status 200)
          headers (get response :headers {"Content-type" "text/html"})
          body (get response :body "")]

        (.writeHead res (status (to-object headers)))
        (.end res (body))))
        
(defn run [handler port]
    (.listen (.createServer http ((fn [req res] (process req res handler)))) (port))
    (println "Server listening at port " port))
    
(run handler 3000)

It's a simple webserver using a http module that is parsed to clarence. It will run on http://localhost:3000


Made by Timo Sarkar

Licensed under MIT

Domo Arigato!

... And happy coding!

0.2.2

4 years ago

0.2.1

4 years ago

0.0.1

4 years ago