GithubHelp home page GithubHelp logo

helple / barn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from barn-lang/barn

0.0 0.0 0.0 17.57 MB

Barn i'ts a simple programming language written in C that is compiled to C.

Home Page: https://barn-lang.github.io/barn-docs/

License: GNU General Public License v3.0

Shell 1.14% C 92.51% Makefile 0.54% Vim Script 0.90% JavaScript 2.10% Python 2.81%

barn's Introduction

REWRITE OF BARN!!!

READ MORE HERE Old Go compiler is in barngo repository

Barn

About

Barn is in experimental version (BETA)

Barn is a simple programming language written in GoLang and compiled to C. Syntax is very simple, and Barn can call C/C++ functions natively so creating new bindings should be easy. Barn was written with the goal of being as fast and easy to use as possible. Barn is just a little project with which I can chill and just code.

Documentation

You can find barn documentation at /documentation

Syntax

Hello World

01-hello-world.ba

fun main() {
   println("Hello World\n")
}

Variables

14-function-arguments-variable.ba

fun example_function(int i1, string str1, bool b1, char c1, float f1) {
    println(str1)
    println("\n")
}

fun main() {
    let i1: int = 1
    let str1: string = "str"
    let b1: bool = true
    let c1: char = 'A'
    let f1: float = 1.0
    example_function(i1, str1, b1, c1, f1)
}

Fizz Buzz in Barn

31-fizz-buzz-in-barn.ba

@import "std.ba"

fun main() {
    for let i: int = 0; i != 1000; i++ {
        if (i % 15) == 0 {
            println("FizzBuzz\t")
        } elif (i % 3) == 0 {
            println("Fizz\t")
        } elif (i % 5) == 0 {
            println("Buzz\t")
        } else {
            printnum(i)
            println("\t")
        }
    }
}

If statements

19-if-condition.ba

fun main() {
    let age: int = 13
    if (age == 13) {
        println("Age is 13\n")
    } elif (age == 14) {
        println("Age is 14\n")    
    } else {
        println("Age isn't 13\n")
    }
}

User input

@import "std.ba"

fun main() {
	println("What's your name: ")
	let user_name: string = input()
	println("Welcome ")
	println(user_name)
}

Extensions

Visual Studio Code

Here!, copy barn-lang folder to where you installed visual studio code (usually $HOME/.vscode/extensions/)

Vim

Here! move barn.vim into .vim/syntax/ and add the following line to ~/.vimrc autocmd BufRead,BufNewFile *.barn set filetype=barn

Documentation

HERE!!

Bugs

If you found a bug immediately call me about it, you can create Github Issue, write to me on Discord Solindek#9808 or on my website contact page

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.