Coder Social home page Coder Social logo

cript's Introduction

Cript

A simple and lightweight script language.

中文介绍

Language feature

  • supported types
    • 30bits signed integer
    • 256byte-max-length internal string
    • hash-based Object and Array
    • value-captured Closure
    • lightweight C function
    • GC managed userdata
  • dynamic types
  • full support of recursion
  • on-the-fly import
  • call script functions from C functions and vise-versa

Virtual machine feature

  • copy-and-swap GC
  • register-based VM
  • SSA-like IR
  • able to register C functions
  • zero dependency except libc

Current limitation

  • only support while loop and if branch statement
  • heap size is hardcoded as 1MB
  • single thread
  • 32bits VM

Compile

git clone https://github.com/clarkok/cript.git
cd cript
mkdir build
cd build
cmake ../
make

Run script

./path/to/cript ./path/to/script.cr

Hello world!

// save it to hello_world.cr and run it!
global.println('Hello World!');

Example scripts

See test/script_test, there is enough examples.

Current status

Trying to optimize compiler

Faster than NodeJS

Haha, just kidding.

screenshot

cript's People

Contributors

clarkok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ifzz m561247

cript's Issues

Optimization TODO List

  • Common subexpression estimate
  • Basic block reorder to prevent extra J inst
  • Register rename to reduce frame size
  • Block level dead code estimate
  • Loop invariant move

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.