Giter Club home page Giter Club logo

klox's Introduction

My Kotlin interpreter for the Lox Programming Language.
following the amazing book Crafting Interpreters.

About Lox: Lox is an Object Oriented Dynamic Scripting language with Higher-Order Functions support, Designed by Bob Nystrom.


What makes this implementation different than other Kotlin implementations (aside from my messy git log), is that it doesn't stick to the book in terms of design patterns;

I tried to embrace functional Kotlin in this project, yet (unfortunately) I've not even come close to pure Functional Programming principles.

The thing is, having mutable global state floating around each pass in the compiler is extremely inconvenient to maintain/debug.

In the broken_immutable_state branch you'll find my obviously-broken attempt at immutable state with Kotlin's implementation of persistent data structures.
But without implicit parameters support it was really painful to implement.

However, I didn't completely give up on FP with Kotlin; the Lexer, Parser, Resolver, and Interpreter are all functions. Recursion and pattern-matching (as limited as kotlin's support for it) are heavily used, and I plan to refactor the entire project to render it as functional as possible.

I did consider using ΛRROW, but so far it feels to me like a language inside the language. Perhaps Kotlin is not ready yet to be a pure functional language (on it's own)?
roll news-report music

klox's People

Contributors

mhashim6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dominictassio

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.