Coder Social home page Coder Social logo

small-programing-languge's Introduction

Small Lang

Small Lang is a small programming language

This language is small, as its name suggests. But it is also powerful as it follows the example of LISP in leveraging the expressive power of lambda functions.

Features

  • numbers
  • strings
  • variables
  • functions
  • lambda functions
  • other data types (like arrays and dictionaries) can be supported via adding runtime functions

Code Example

The following code example contains all of the features of the language:

print("Hello, world")
print("3 + 5 =" add(3 5))

hello = (subject) => {
    print(concat("Hello, " subject))
    print(concat("Hello, " subject))
}

doIt = () => {
    print("Do it!")
}

doIt()

hello("Brother")

classmates = split("Jerry Jordan Johnny Jack Jeffery" " ")

each(classmates (peep) =>
    print(concat("Hello " peep))
)

fib = (n) =>
    if(eq(n 1)
        () => 1
        () =>
            if(eq(n 2)
                () => 1
                () =>
                    add(
                        fib(subtract(n 1))
                        fib(subtract(n 2))
                    )
            )
        )

print(fib(9))

Todo List

  • parser
    • define moo lexer
      • number literal
      • string literal
      • assignment operator
      • identifier
      • parans
      • braces
      • fat arrow
      • whitespace
      • newline
    • make a parse.js that creates .ast files
    • variable assignment
    • function call
    • multiple lines
    • lambda function
    • comments
  • generator
    • make a generate.js that creates .js files
    • variable assignment
    • function call
    • runtime functions
    • lambda function
    • comments
  • code challenges

Demo video

small.lang.demo.mp4

small-programing-languge's People

Contributors

sudeep162002 avatar

Stargazers

 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.