Skip to content
Starting code of the first challenge in the Let's Build a Programming Language series.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc First commit Sep 13, 2017
.gitignore First commit Sep 13, 2017
README.md Update README.md Sep 14, 2017
lexical-grammar.txt Add production rules for newlines and comments Sep 14, 2017
package.json

README.md

LBPL Challenge 1: Build a lexer for Blink

Welcome to the first challenge in the Let's Build a Programming Language series. The goal of this challenge is to write a lexer for Blink.

How to setup

Start by forking this repository to your own Github account.

Once the project is forked, make sure that you have the latest version of Node.js installed and run the following commands in a command line prompt to setup the challenge.

  1. $ git clone https://github.com/<replace_with_your_github_username>/blink-lexer.git
  2. $ cd blink-lexer
  3. $ npm install

How to complete the challenge

The goal of this challenge is to write a lexer for Blink in JavaScript (ES6). For that purpose, in the src/main/lexer directory, you have been provided with a Token class, a TokenType enumeration, a basic skeleton for the Lexer class, as well as a test file in src/test/lexer/lexer-test.js. Your job is to make all the tests pass by completing the Lexer class.

Your starting point ...

  • tokentype.js contains all the types of token available in Blink.
  • token.js contains a simple Token class.
  • lexer.js contains a skeleton for a Lexer class with a empty nextToken() method. This is the file where all of your changes should be made.
  • lexer-test.js contains the unit tests validating that your implementation of the Lexer class works as expected.
  • lexical-grammar.txt contains the regular expressions describing valid Blink lexemes. This will serve as guide when implementing the nextToken() method in the Lexer class.
  • A tour of Blink. An overview of all the features in Blink.

How to run the tests

Whenever you're ready to test your code

  1. run npm run build at the root of the project to build
  2. and npm run test to run the tests

Reporting bugs and Suggestions

Please create a Github issue if you found something that needs to be fixed on this project or if you have a suggestion to improve it.

Support and Help

Feel free to ping me on Twitter @ftchirou if you have any question or need a clarification while completing this challenge.

Have fun. 🙌

You can’t perform that action at this time.