GithubHelp home page GithubHelp logo

hhy5277 / bon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daniel-p-gonzalez/bon

0.0 1.0 0.0 99 KB

Bon is a programming language designed with simplicity, performance, and safety in mind.

License: MIT License

Shell 0.37% CMake 0.44% C++ 99.11% C 0.08%

bon's Introduction

Introduction

Bon is a programming language designed with simplicity, performance, and safety in mind. If you just want a quick tour of the language, you can start here.

Simplicity

In all aspects of its design, Bon aims to be succinct, yet readable.

Code written in Bon tends to look similar to a scripting language such as Ruby or Python:

def fib(x)
    if x < 2
        x
    else
        fib(x-1) + fib(x-2)
    end
end

print("Hello, World!")
print(fib(15) == 610)

Performance

Bon uses LLVM to generate efficient machine code, either JIT compiled, or pre-compiled to a binary.

Calculating the 45th fibonacci number using a simple recusive implementation (as above) in Bon, C++, Ruby, and Python:

# Bon (time for compile and run)
$ daniel@daniel-laptop:~/bon$ time ./bon examples/fib.bon
1134903170

real    0m6.749s
user    0m6.725s
sys     0m0.005s

# C++ (time for compile and run)
$ daniel@daniel-laptop:~/bon$ time (clang++ fib.cc -o fib -O3 && ./fib)
1134903170

real    0m6.071s
user    0m5.996s
sys     0m0.054s

# Ruby
daniel@daniel-laptop:~/bon$ time ruby fib.rb
1134903170

real    2m16.625s
user    2m16.578s
sys     0m0.020s

# Python
daniel@daniel-laptop:~/bon$ time python fib.py
1134903170

real    4m42.735s
user    4m42.724s
sys     0m0.012s

Safety

Performance doesn't have to come at the expense of safety, and safety doesn't have to come at the expense of simplicity. Bon has a powerful static type system which allows for simplifying code with type inference and pattern matching. In addition, defining recursive data types such as lists or trees is straight forward.

Learn more in the documentation

Why another programming language?

Bon is being designed as a programming language built around all of the things that make me enjoy programming, and it's dedicated to the memory of my mother. Her name was Bonnie, but everyone called her Bon, so that is where the name comes from. More information is available on my patreon page: https://www.patreon.com/d_p_gonz

bon's People

Contributors

daniel-p-gonzalez 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.