in my last post, I was talking about how messy my parser was getting, so a good man named Olivier told me about the Earley algorithm, I've been trying to learn how to properly use it since then.
So today I am introducing to the world LQL, the Luis Query Language, it's basically the same thing I was trying to do with my original parser with even fewer functions (for now) but with way better-structured code.
I haven't yet started to use the parser in the main project, but I was so proud my initial test cases passed I felt like writing this post.
It takes a string input that matched the "select" command pattern and transforms it into a JSON that I will later use.
Generates this output:
In the column parameter, it also supports strings:
loved working with nearley, so much that I am thinking my next project will be creating a programming language with node, but that seems way too bold for now.
I've published the parser in npm and Github
if you wanna play with it you can install it with
npm install lql-parser
and if you wanna check the code out, this is the repo >
This is the guy that told me about Earley, I tried to reach him on Linkedin to thank him but couldn't, so this post is my thank you note to him
That's all I had to say
Happy new year to everyone :)