Code Monkey home page Code Monkey logo

juicyscript's Introduction

juicyscript

Sweet experimental scripting language

Philosophy

JuicyScript is a scripting language inspired by Lua, Ruby and JavaScript

Variables

Declared variables are always immutable

num = 5
num = 8 // Exception: Variable cannot be re-assigned

Primitives

hello = 'world'
num = 5
sum = num + 2
bool = true

Structures

There is no distinction between objects and arrays.

hello = ('world', 'earth')
// is the same as
hello = ('0': 'world', '1': 'earth')
numbers = (1, 2, 3, 4)
named = (hello: 'world', hi: 'there')

number = 5 // This is the same as number = (5)

hello[0] // 'world'
named.hello // 'world'

#### Destructuring Not sure about this. Might cut this feature.

unpack (numA, numA) = (1, 2)
numA // 1
numB // 2
unpack (age, name) = (age: 19, name: 'this')
age // 19
name // 'this'

Functions

#### Single-line functions

answer = () => 42
answer()

Multi-line functions

logPerson = (person) => {
  print(person.name)
  print(person.age)
}

logPerson(name: 'me', age: 19)

Modules

Not sure about this. Might cut this feature.

By default everything inside of a source file is private

// moduleA.juicy
export num = 5
export log = (name) ->
  print(name)
end
// moduleB.juicy
moduleA = import './moduleA'
unpack (num, log) = import './moduleA'

License

MIT

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.