Code Monkey home page Code Monkey logo

jupiter's Introduction

Jupiter Programming Language

Jupiter is A dynamic object-oriented programming language based on Smalltalk/Self.

Features

  • A set of simple core types:
    • Decimal floating point Numbers to avoid this: https://0.30000000000000004.com/.
    • Strings.
    • Arrays: Number indexed collections.
    • Maps: String indexed collections.
  • Immutable data structures.
  • There are no classes. Objects are created copying other objects ( prototypes ). Thanks to immutability no special semantics is needed to achieve this.
  • Unix friendly: Its source code is stored in files, which is not the 'Smalltalk way', but this allow us easy interaction with other Unix tools, like git, grep, IDE's/text editors etc.. See Juno IDE.
  • Generational garbage collector: The immutable data structures generate a lot a short-lived objects, using a generational GC improves the performance of collecting and reusing these temporal objects.
  • Tail call optimization: Recursive methods are the only way to make loops in Jupiter. This optimization make tail recursive calls as efficient as a imperative loops.
  • Compile inline if expressions. If expressions can be implemented as a regular message/method call in Smalltalk, but this is not very efficient, so Jupiter transform if expression into jump bytecodes.

Juno IDE

For a better programming experience (or at least more similar to other Smalltalk environments), you can use the Juno IDE

Some examples

"The traditional hello world program"
'Hello world!' print
"double a list of numbers"
numbers := {1,2,3}.
double := numbers map: [ :number | number * 2 ].
double == {2,4,6}
"sum two point objects"
aPoint := 1 @ 2. otherPoint := 2 @ 2. sum := aPoint + otherPoint

Check the tests ( in lib/core/src/core/tests/ ) for more examples

Differences with other Smalltalk systems

Syntax

The Jupiter syntax is mostly the same as other smalltalk implementations, with a few differences:

  • No need to declare local variables
  • Local variables cannot be reassigned ( a := a + 1 won't work )
  • No Static Array syntax
  • Elements in dynamic Arrays are separated by comas
  • No return symbol. Methods return the last evaluated expression.

Objects

The object model is similar to Self. Jupiter has no classes, all objects are created copying other objects.

An Object in Jupiter is just an immutable persistent key-value collection of objects. The messages sent to objects don't modify the state of the object, instead return a new object with the updated state, therefore creating instances of objects ( cloning or copying prototypes ) is trivial.

Build requirements

Setting the JUPITERHOME environment variable

The interpreter needs this environment variable to load the core library. (In the future this won't be necesary, when proper installation scrips and/or packages are provided )

Navigate to the project folder:

$ cd jupiter-master/
$ export JUPITERHOME=$PWD/lib

Docs and Tutorial

Coming soon...

Status

This project is yet in alpha state, so it may crash/leak memory/explode from time to time.

License

This project is licensed under the MPL-2.0 License. See the LICENSE file for details

jupiter's People

Contributors

davidarias avatar

Stargazers

gavr avatar latrokles avatar Joseph Tan avatar Roman avatar Sharaf Qeshta avatar  avatar Eric Gade avatar

Watchers

 avatar

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.