Giter Club home page Giter Club logo

fibin-language's Introduction

fibin language

A simple functional language written using c++ templates.


coauthor: @Pawel494

Semantics

  • Literals Lit - only allowed Fibbonaci numbers (non negative): Fib<0> = 0, Fib<1> = 1 ... or logic values: True, False,
    example:

    Lit<Fib<0>>, Lit<True>
    
  • Variables Var:

    Var(const char*)
    

    labels are string (1 to 6 signs) with letters (case insensitive) and digits,
    example:

    Var("A"), Var("01234"), Var("Cdefg")
    
  • Arithmetic operations Sum, Inc1, Inc10

    • Sum<...> - multiple arguments sum (at least two),
    • Inc1<Arg> - adds Fib<1> to Arg,
    • Inc10<Arg> - adds Fib<10 to Arg,

    example:

    Sum<Lit<Fib<0>>, Lit<Fib<1>>, Lit<Fib<3>>>, Inc1<Lit<Fib<0>>>
    
  • Comparison Eq - Eq<Left, Right> compares value of Left with Right,
    example:

    Eq<Lit<Fib<0>>, Lit<Fib<1>>>
    
  • Refernce Ref - Ref<Var> return the value of Var,
    example:

    Ref<Var("A")>
    
  • Expression Let - Let<Var, Value, Expression> assigns Value to the Var and calculates given Expression,
    example:

    Let<Var("A"), Lit<Fib<1>>, Ref<Var("A")>>
    
  • Expression If - If<Condition, Then, Else> if Condition result is True then calculates value of Then otherwise value of Else is calculated, \ example:

    If<Lit<True>, Lit<Fib<1>>, Lit<Fib<0>>>
    
  • Expression Lambda - Lambda<Var, Body> reprezents anonymous function with singe input argument Var and body Body,
    example:

    Lambda<Var("x"), Ref<Var("x")>>
    
  • Function invocation Invoke - Invoke<Fun, Param> calculates Fun result for the given input parameter Param,
    example:

    Invoke<Lambda<Var("x"), Ref<Var("x")>>, Lit<Fib<0>>>
    

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.