GithubHelp home page GithubHelp logo

intuitionmachine / bosquelanguage Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/bosquelanguage

0.0 1.0 0.0 185 KB

The Bosque programming language is an experiment in regularized design for a machine assisted rapid and reliable software development lifecycle.

License: Other

TypeScript 100.00%

bosquelanguage's Introduction

Bosque Programming Language

Licensed under the MIT License PR's Welcome Build Status

The Bosque programming language is a Microsoft Research project that is investigating language designs for writing code that is simple, obvious, and easy to reason about for both humans and machines. The key design features of the language provide ways to avoid accidental complexity in the development and coding process. The result is improved developer productivity, increased software quality, and enable a range of new compilers and developer tooling experiences.

Small samples of code to give a sample flavor are below (Code Snippets). A rundown of notable and/or unique features in the Bosque language is provided in the language overview section 0. For a look at how the language works and flows in the large please see the code for a simple tic-tac-toe program that supports updating the board with user supplied moves, making an automated computer move, and managing the various game state.

Note: This repository and code represent a project in an early state. This was done to enable academic collaboration and community participation. However, this means that the language is subject to revision, there are bugs and missing functionality, and the performance is limited. Thus, we do not recommend the use of the Bosque language for any production work and instead encourage experimentation only with small/experimental side projects at this point in time.

Documentation

Code Snippets

Add 2 numbers:

function add2(x: Int, y: Int): Int {
    return x + y;
}

add2(2, 3) //5

All odd check using rest parameters and lambda:

function allOdd(...args: List[Int]): Bool {
    return args->all(fn(x) => x % 2 == 1);
}

allOdd(1, 3, 4) //false

Bulk update properties on Record

function update(point: {x: Int, y: Int, z: Int}, value: Int): {x: Int, y: Int, z: Int} {
    return point<~(y=value, x=-point.x);
}

update(@{x=1, y=2, z=3}, 5) //@{x=-1, y=5, z=3}

Noneable access on optional argument:

function tryGetProperty(r?: {f: Int, k: Int}): Int? {
    return r?.f;
}

Sign (with optional argument):

function sign(x?: Int): Int {
    var! y;

    if(x == none || x == 0) {
        y = 0;
    }
    else {
        y = (x > 0) ? 1 : -1;
    }

    return y;
}

Using the Bosque Language

The current focus of the Bosque project is core language design. As a result there is limited support for compilation/development and no support for packaging, deployment, lifecycle management, etc.

Requirements

Windows

In order to build the language for Windows the following are needed:

  • The LTS version of node.js for Windows (x64)
  • Typescript (install with: npm i typescript -g)

Build & Test

The ref_impl directory contains the reference implementation parser, type checker, interpreter, and command line runner. In this directory, build and test the Bosque reference implementation with:

npm install && npm run-script build && npm test

Command Line Execution

The ref_impl directory contains a simple command line runner for standalone Bosque (.bsq) files. These files must have a single entrypoint function called main() (see some examples). The code in the file can be parsed, type checked, and executed with:

node bin/test/app_runner.js FILE.bsq

Visual Studio Code Integration

This repository provides basic Visual Studio Code IDE support for the Bosque language (currently limited to syntax and brace highlighting). The installation requires manually copying the full bosque-language-tools/ folder into your user .vscode/extensions/ directory and restarting VSCode.

Contribute

This project welcomes community contributions.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Please refer to Contribution Guidelines for more details.

License

Code licensed under the MIT License.

bosquelanguage's People

Contributors

0xflotus avatar arkark avatar augustshultz avatar brianwhited avatar christopherm99 avatar enhsaihan-d avatar hearot avatar hong4rc avatar jimmyhmiller avatar mairwunnx avatar microsoftopensource avatar mrkmarron avatar msftgits avatar plankp avatar rtoal avatar stephen-oneil avatar terryag avatar thammarith avatar wizofe 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.