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.
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.
$ git clone https://github.com/<replace_with_your_github_username>/blink-lexer.git
$ cd blink-lexer
$ npm install
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.
- 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 emptynextToken()
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 theLexer
class. - A tour of Blink. An overview of all the features in Blink.
Whenever you're ready to test your code
- run
npm run build
at the root of the project to build - and
npm run test
to run the tests
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.
Feel free to ping me on Twitter @ftchirou if you have any question or need a clarification while completing this challenge.
Have fun. 🙌