The "Strange expression language" is only used to train regular expressions and parser design for JavaScript in a hopefully not so boring way.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Commitizen friendly code style: prettier

The StrexLang ("Strange expression language") is only used to train regular expressions and parser design for JavaScript in a hopefully not so boring way 😎.



Goal of this task is to create an AST in JavaScript that can be serialized. Also to get to know regular expressions in combination with .replace (and what ever fits your needs as well). To get into it step by step you should start with regular expressions and can rewrite it later with a tokenizer.

To test regular expressions can be used (in JavaScript mode). Later on (phase 8) the regular expressions are replaced with a tokenizer for a process called "lexical analysis" to give more control over the parser.


An overview of the StrexLang itself can be found in docs/

How to start


Clone this repository locally:

git clone && cd strex-lang

or even better fork this repository. This also makes it easier to update your repository later.

After this install the necessary NPM dependencies:

npm i

Note: If you forked this repository to implement your parser it would be lovely to send a PR here to add it to the list of possible implementations made by the community 🎉

Start development

Open the file src/parser/index.js in your favorite code editor and read the comments included that will provide further guidance.

To test your progress you can execute npm test and see how many green you get 🚀. All tests for the parser separated by the phases can be found in the folder src/parser/__tests__. This can also provide further documentation.


Development can be done in phases to get step by step to a more and more sophisticated language.

  1. Basic language
  2. Advanced types and calculations
  3. Error handling
  4. If expressions
  5. Nested if expressions
  6. "And" and "or" if expressions
  7. Error messages for if expressions
  8. Human readable error messages
  9. Multi line expressions

Phases can also be tested with npm test -- phase-01 for the first phase. If a later phase is tested all phases before are executed as well to ensure nothing broke.

Note: running npm test will execute not only all phases but the compiler tests as well. If you only want to execute compiler tests you can run npm test -- compiler.