How to write a lexer in js or c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to write a lexer in js or c++ ?

I wanna lexer using js code or c++ code. Could anyone help ?

3rd Feb 2019, 12:25 PM
Akash S P
Akash S P - avatar
2 Answers
+ 2
You can just use regular expressions. In JS, create an array of tokens and in C++, create a linked list of tokens. There are already some tools for this in C++. Look for lex/flex and yacc/bison.
3rd Feb 2019, 1:09 PM
Division by Zero
0
I recommend that you watch this: https://www.youtube.com/watch?v=TG0qRDrUPpA
3rd Feb 2019, 1:16 PM
Dennis
Dennis - avatar