All Projects → lice-lang → Lice

lice-lang / Lice

Licence: gpl-3.0
A multi-paradigm programming language running on JVM

Programming Languages

kotlin
9241 projects
language
365 projects
lisp
113 projects

Projects that are alternatives of or similar to Lice

Mini Jvm
使用 JDK8 实现 JVM(Java Virtual Machine)
Stars: ✭ 568 (+373.33%)
Mutual labels:  interpreter, jvm
Openj9
Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Stars: ✭ 2,802 (+2235%)
Mutual labels:  interpreter, jvm
Kivm
🌟This is a pure C++ implementation of Java Virtual Machine (only Java 8 is supported). Inspired by Hotspot In Action.
Stars: ✭ 137 (+14.17%)
Mutual labels:  interpreter, jvm
openj9
Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Stars: ✭ 2,973 (+2377.5%)
Mutual labels:  interpreter, jvm
pikt
🎨 Image-based poetic programming language.
Stars: ✭ 72 (-40%)
Mutual labels:  interpreter, jvm
kpspemu
PSP Emulator written in Kotlin for JVM, JS and Native. Can work as PWA.
Stars: ✭ 57 (-52.5%)
Mutual labels:  interpreter, jvm
LLVM-JVM
[W.I.P] A Just-In-Time Java Virtual Machine written in Haskell
Stars: ✭ 22 (-81.67%)
Mutual labels:  interpreter, jvm
go-jdk
Run JVM-based code in Go efficiently
Stars: ✭ 61 (-49.17%)
Mutual labels:  interpreter, jvm
Seax
A VM-based runtime environment for functional programming languages
Stars: ✭ 36 (-70%)
Mutual labels:  interpreter, lisp-interpreter
Enterprise
🦄 The Enterprise™ programming language
Stars: ✭ 1,493 (+1144.17%)
Mutual labels:  jvm
Cpi
Tiny c++ interpreter
Stars: ✭ 116 (-3.33%)
Mutual labels:  interpreter
Golisp
Lisp Interpreter
Stars: ✭ 107 (-10.83%)
Mutual labels:  lisp-interpreter
Dummylua Tutorial
这是一个仿制lua解释器的项目,我希望通过逐步实现lua解释器的各个部分,更加深刻地掌握lua的基本结构和运作原理。
Stars: ✭ 108 (-10%)
Mutual labels:  interpreter
Android Readthefuckingsourcecode
😜 记录日常的开发技巧,开发中遇到的技术重点、难点,各个知识点的总结,优质面试题等等。持续更新...
Stars: ✭ 1,665 (+1287.5%)
Mutual labels:  jvm
Libforth
libforth: A small Forth interpreter that can be used as a library written in c99
Stars: ✭ 107 (-10.83%)
Mutual labels:  interpreter
Writing an interpreter in elixir
Elixir implementation of an interpreter for the Monkey programming language
Stars: ✭ 119 (-0.83%)
Mutual labels:  interpreter
Miniboxing Plugin
Miniboxing is a program transformation that improves the performance of Scala generics when used with primitive types. It can speed up generic collections by factors between 1.5x and 22x, while maintaining bytecode duplication to a minimum. You can easily add miniboxing to your sbt project:
Stars: ✭ 106 (-11.67%)
Mutual labels:  jvm
Swiftylisp
A minimal LISP implemented in Swift
Stars: ✭ 106 (-11.67%)
Mutual labels:  interpreter
Simple
The Simple Intelligent and Modular Programming Language and Environment
Stars: ✭ 120 (+0%)
Mutual labels:  interpreter
Kotlinnativesample
Kotlin Native app working on Android & iPhone
Stars: ✭ 119 (-0.83%)
Mutual labels:  jvm

Lice

CI status
Travis CI Build Status
AppVeyor Build status
CircleCI CircleCI
CodeShip Codeship Status for lice-lang/lice

JitPack
Download
Gitter
Dependency Status
codecov
License: GPL v3
Awesome Kotlin Badge

About

This is the interpreter of Lice language, a dialect of Lisp, run on JVM platform.

It supports call-by-value, call-by-name, call-by-need(we sometimes call it lazy evaluation) at the same time. Functions and values are treated as the same. Dynamic scoping, because I can't find a better scoping solution for a interpreted language.

See FeatureTest to learn more about the language's features.

Also, as the main repo for the Lice language, this repo will not be updated very frequently.
Instead, I do language feature experiments in The tiny version of Lice, which is more actively updated and not guarenteed be backward capable.
Once a feature is finished and tested, and not considered harmful, I'll copy the codes here and publish releases.

It looks like

; print a string
(print "Hello " "World" "\n")

; travel through a range
(for-each i (.. 1 10) (print i "\n"))

; define a call-by-name function
(defexpr fold ls init op
 (for-each index-var ls
   (-> init (op init index-var))))

; invoke the function defined above
(fold (.. 1 4) 0 +)

; passing a call-by-value lambda to a call-by-value lambda
((lambda op (op 3 4)) (lambda a b (+ (* a a) (* b b))))

; to define a call-by-need lambda, use `lazy`.

Building

To use Lice with build tools, first add jcenter to your repositories list.

With gradle, add this to your dependencies list:

compile 'org.lice:lice:3.3.2'

Or with maven:

<dependency>
  <groupId>org.lice</groupId>
  <artifactId>lice</artifactId>
  <version>3.3.2</version>
  <type>pom</type>
</dependency>

Or with ivy:

<dependency org='org.lice' name='lice' rev='3.3.2'>
  <artifact name='lice' ext='pom'/>
</dependency>

Alternatively, you can download the nightly jar for the newest commit on AppVeyor.

Script API

import javax.script.*;

public class LiceScriptEngineTest {
    public static void main() throws Exception {
        ScriptEngine engine = new ScriptEngineManager().getEngineByName("lice");
        engine.eval("(-> x 10)");
        engine.eval("(print x)");
    }
}

Lice performance

Code to run:

; loops
(def loop count block (|>
    (-> i 0)
    (while (< i count) (|> (block i)
    (-> i (+ i 1))))))

; invoking the function
(loop 200000 (lambda i (|>
    (defexpr let x y block (|>
        (-> x y) ; this is actually an issue of lice.
        (block)
        (undef x)))
    (let reimu 100 (lambda (|> x))))))

(print "loop count: " i)

Environment: Ubuntu Linux 16.04, HotSpot 1.8u151, Intel core i7 4720HQ 2.6 GHz

Condition Time
Lice call Java using extern 350ms
Lice call Java using Lice API 295ms
Pure Java 13ms
Pure Lice 897ms
Java call Lice using Lice API 629ms

Lice invoking Java

Lice has handy APIs for interacting with Java.

; declare an extern function
; must be a static Java function
(extern "java.util.Objects" "equals")

; calling the extern function
(equals 1 1)

Java invoking Lice

This project provides handy APIs for running Lice codes from Java.

class SomeClass {
  public static void main(String[] args){
    // Running Lice
    System.out.println(Lice.run("(+ 1 1)")); // prints 2
    System.out.println(Lice.run(new File("example.lice"))); // run codes in a file
    
    // Lice API
    SymbolList env = new SymbolList();
    Lice.run("(def blablabla a (+ a a)) (-> myVar 233)", env);
    env.extractLiceFunction("blablabla").invoke(233); // result: 466
    int var = ((Number) env.extractLiceVariable("myVar")).intValue(); // result: 233
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].