Giter VIP home page Giter VIP logo

sylk's Introduction

sylk

drawing

Simple fully turing complete programming language that include almost all of the features of a common programming language.

Building

Just use make. The project have no dependencies.

If you want to run the tests you need to install google test. After you install it just run make test and then ./sylk_test.

Running

./sylk examples/fibonacci.slk to run an example.

If you want to use the interpreter as a lib you just need to include the sylk.h header from the src directory to use the functions and link the sylk library.

Documentation

Variable declaration

to declare a variable you need to use the var keyword.

var a
var b

you can also initialize the variables.

var text = 'hello world'

Function declaration

to declare a function you need to use the def keyword.

def square(n) {
    return n * n
}

Class declaration

to declare a function you need to use the class keyword

class Test {
    var a
    var b

    def constructor(a, b) {
        self.a = a
        self.b = b
    }

    def add() {
        return self.a + self.b
    }
}

Members are declared with the var keyword like variable declarations but the can't be initializated.

The constructor is declared as a normal method but it needs to be named constructor.

You can access the instance in a method with the self keyword.

note first you need to declare the members and then the methods or it will not compile

Conditionals

The conditionals works like in any other programming language

if a == 2 {
    print(a * a)
}
while n > 0 {
    print(n)
    n = n - 1
}

note there is no for statement yet.

Assignment

you can assign a value to a variable with =

var b
b = 15

you can also assign a different type to a variable

var b = false
b = 'hello'
print(b)

note assignment is a statement and not an expression so you can't use assignments where expressions are required.

while n = next() {
    print(n)
}

the code above will not compile.

Roadmap

  • arithmetic operations
  • if/else
  • assignments
  • while
  • function calls
  • logical operations
  • function defenitions
  • string support
  • classes
  • list data structure
  • garbage collector
  • standard library

sylk's People

Contributors

catalyn45 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.