Giter VIP home page Giter VIP logo

lula-language's Introduction

Lula Language

lula_language_logo

[sarcasm]

Lula programming language was created in order to provide the easiest, faster and a reliable way for developers to create their beloved applications. You will never get disappointed with Lula, I can assure you that. If you are tired of all the regular programming languages out there, come and join the LULA community and let's spread the knowledge among those who need. Knowledge must be free and reach all, mainly those in need.

PS - Lula is still being developed, so most of the features bellow are not ready yet. If you want to keep up to date with Lula, just star the project.

[sarcasm /]

Usage

Install the Lula using go get:

$ go get -v -u github.com/IAPOLINARIO/lula-language/...

Then run REPL:

$ $GOPATH/bin/lula-language
This is the Lula language!
Feel free to type in commands
>>

Or run a Lula script file (for example script.lula file):

$ $GOPATH/bin/lula-language script.lula

Getting started with Lula

Variable bindings and number types

You can define variables using pt keyword. Supported number types are integers and floating-point numbers.

>> pt a = 1;
>> a
1
>> pt b = 0.5;
>> b
0.5

Arithmetic expressions

You can do usual arithmetic operations against numbers, such as +, -, * and /.

>> pt a = 10;
>> pt b = a * 2;
>> (a + b) / 2 - 3;
>> pt c = 2.5;
>> b + c
22.5

If expressions

You can use se and senao keywords for conditional expressions. The last value in an executed block are returned from the expression.

>> pt a = 10;
>> pt b = a * 2;
>> pt c = se (b > a) { 99 } senao { 100 };
>> c
99

Functions and closures

You can define functions using companheiro keyword. All functions are closures in Lula and you must use pt along with companheiro to bind a closure to a variable. Closures enclose an environment where they are defined, and are evaluated in the environment when called. The last value in an executed function body are returned as a return value.

>> pt multiply = companheiro(x, y) { x * y };
>> multiply(50 / 2, 1 * 2)
50
>> companheiro(x) { x + 10 }(10)
20
>> pt newAdder = companheiro(x) { companheiro(y) { x + y }; };
>> pt addTwo = newAdder(2);
>> addTwo(3);
5
>> pt sub = companheiro(a, b) { a - b };
>> pt applyFunc = companheiro(a, b, companheiro) { companheiro(a, b) };
>> applyFunc(10, 2, sub);
8

Returning values

To return values from a function you need to use the keyword devorve

>> se (10 > 20) {
>>	devorve verdade;
>>}

Strings

You can build strings using a pair of double quotes "". Strings are immutable values just like numbers. You can concatenate strings with + operator.

>> pt makeGreeter = companheiro(greeting) { companheiro(name) { greeting + " " + name + "!" } };
>> pt hello = makeGreeter("companheiro");
>> hello("companheiro");
Hello companheiro!

Booleans

You can return boolean values with verdade and mentira.

>> se (5 < 10) {
>>	devorve verdade;
>> } senao {
>>	devorve mentira;
>> }

Disclaimer

Needless to say, but this is just a joke and a way I found to learn GO in a fun way. Don't take it serious, because I don't ;)

lula-language's People

Contributors

iapolinario avatar

Stargazers

Adilson Roberto Cavicchioli Junior avatar Charles Leverington avatar Lucas Lorentz avatar Diogo Torres 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.