Git Product home page Git Product logo

turin-programming-language's Introduction

Turin programming language

Build Status Documentation

Turin is a pragmatic static language for the JVM.

Documentation

Available here.

Philosophy

Programming should be about describe data, phenomenons, processes and interactions. The language should not stay in the way to let us focus on this fun and challenging task.

Goals

The initial goal is to complement Java for a series of tasks for which it is not strongly suited. The initial focus is on the definition of datatypes with proper defaults (no need to write or generated hashCode, equals, getters and setters in most cases).

We want to be pragmatic: to start with a small language and make it usable in practice as soon as possible. To do so we are working on an IntelliJ plugin and we plan to start working soon on a Maven plugin.

Status

Types with properties and methods can be defined and can compiled to class files. It is possible to invoke Java from Turin and viceversa.

Supporting tools

Examples

This is an example of a program (compiling & running) written in Turin.

namespace manga

// now print is an alias for call to all the overload variants of println on System.out
import java.lang.System.out.println as print

// we define this property in generale: a name is a String
property String : name

// this is our new datatype
type MangaCharacter {
    // we refer to the property defined above
    has name
    // we define a new property, UInt is an unsigned int
    has UInt : age
    
    // we overload toString. For short methods it can make sense to use 
    // this shorthand. And we have string interpolation
    String toString() = "#{name}, #{age}"
}

// this define a class with a main method
program MangaExample(String[] args) {
    // type inference at work: we are instantiating the class defined above
    // note that the constructor is generated for us
    val ranma = MangaCharacter("Ranma", 16)
    // let's call a java method ( System.out.println(String) ) and use more
    // string interpolation
    print("The protagonist is #{ranma}")
}

It prints: The protagonist is Ranma, 16

Applications in Turin

So far I started working on one application in Turin. It is a java-formatter.

License

Turin is released under the Apache License v2.0

Contributing

All sorts of questions, advices and contributions are extremely welcome!

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.