Giter Club home page Giter Club logo

programminglanguageinswifttutorial's Introduction

Implementing a Programming Language in Swift

This repo has the full source code a tutorial I made on implementing a programming language in Swift.

There might be slight differences between this repo and the tutorial due to minor refactoring.

Link to tutorial

programminglanguageinswifttutorial's People

Contributors

valdirunars avatar

Stargazers

 avatar  ◕ ̯͡◕苦瓜 avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

bobbyski

programminglanguageinswifttutorial's Issues

lexing priority & whitespace

I liked this tutorial, thank you. Two suggestions that I implemented in my own version:

  1. Right now there is no precedence among lexing rules, because you store them in a dictionary and the first one that matches (if any) wins. In practice, it’s possible for more than one lexing rule to match. The heuristic that the Racket lexer uses (for example) is that the longest match takes precedence, and if there are multiple matches with the same length, the earlier rule takes precedence.

  2. I don’t think you need trimLeadingWhitespace. You can just make a .whitespace token that matches \\s+. On the right side of that lexing rule, return nil. In other words, you tokenize the whitespace and then throw it away.

Thanks again!

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.