Code Monkey home page Code Monkey logo

kyoto's Introduction

Kyoto Lang

Lightweight functional programming language designed to have a small memory footprint with a declarative memory usage.

  • Documentation website: link
  • Kyoto playground: TBD

Logo Fox Yusuke

Kyoto Language has as primary compilation target: WebAssembly. It’s built for Web and Server usage, see more on compiler spec part.

Features

  • Primary based on stateless functions
  • Lazy evaluation.
  • Enforces memory usage only when it’s declared.
  • Easy cross compilation when targeting a browser host or a WASI host (like Wasmtime, Wasmer and etc).

Kyoto allows you to build applications that are platform agnostic since it runs on WebAssembly Virtual Machine. However you can also specify compilation target as C programming language or even JavaScript.

// Available in
// compilation time
*anotherValue = 5;

// Available in
// runtime and compilation time
yetAnotherValue = 85;

// Exports "myFunction"
pub fn myFunction = mul(2) |> sum(1);

// It will be "transformed"
// into a function that returns 8
pub fn value = 8;

You can compile the code above using kyoto compiler and specifying WebAssembly 32 bits and it will produce a .wasm file.

kyoto main.kto --target wasm32 -o module.wasm

It will produce module.wasm with the following data:

0061 736d 0100 0000 010d 0360 0000 6000
017f 6001 7f01 7f03 0403 0001 0205 0301
0001 071c 0303 6d65 6d02 0005 7661 6c75
6500 010a 6d79 4675 6e63 7469 6f6e 0002
0801 000a 1e03 0a00 4100 41d5 003a 0000
0b05 0041 080f 0b0b 0020 0041 026c 4101
6a0f 0b

The binary produced above can also be represented as the following code written in WebAssembly text format:

(module
  (memory $mem 1)
  (export "mem" (memory $mem))
  (func $kyoto
    (i32.store8 (i32.const 0) (i32.const 0x55))
  )
  (func (export "value") (result i32)
   i32.const 8
   return)
  (func (export "myFunction") (param i32) (result i32)
    local.get 0
    i32.const 2
    i32.mul
    i32.const 1
    i32.add
    return)
  (start $kyoto)
)

For more information please visit the documentation website: https://raphamorim.io/kyoto/.

kyoto's People

Contributors

raphamorim avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

icodein

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.