Coder Social home page Coder Social logo

corrosion's Introduction

Corrosion

A compiler and interpreter project written in Go and inspired by the books Writing A Compiler In Go and Writing An Interpreter In Go by Thorsten Ball.

Language Style

Corrosion inherits a few language syntax styles. Some examples:

// Syntax examples
var foo = 100;
func add(left, right) { return left + right; }
add(foo, foo); // 200

func conditional(check) {
    if (!check == true) {
        return true;
    } else {
        return false;
    }
}

conditional(); // false

func foo() {
    func bar() { return 2; }
    return bar;
}

foo()(); // 2

Obtaining Source

git clone https://github.com/freddiehaddad/corrosion

Building

go build -o bin ./...

Testing

go test -v ./...

Running

After building the code, the REPL can be launched with:

./bin/corrosion

Dependencies

Go (see go.mod for minimum version) is required for building. In general, any recent version should work.

Project Layout

.
├── bin
│   └── corrosion
├── cmd
│   └── corrosion
│       └── corrosion.go
├── go.mod
├── LICENSE
├── pkg
│   ├── ast
│   │   └── ast.go
│   ├── evaluator
│   │   ├── evaluator.go
│   │   └── evaluator_test.go
│   ├── lexer
│   │   ├── lexer.go
│   │   └── lexer_test.go
│   ├── object
│   │   └── object.go
│   ├── parser
│   │   ├── parser.go
│   │   └── parser_test.go
│   └── token
│       └── token.go
└── README.md

License

Licensed under the MIT license.

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.