Hi, i'm trying to learn more about how Lexical Analyzers/Parsers work. I haven't coded any classes yet, because i'm not really sure how the entire process from a Lexer to working code goes.

My goal is to write a simple made up programming language and translate that to another language, like Javascript. The first thing i have to do is give the code to a Lexical Analyzer.

The lexer will split the source into tokens and assign a label to it. So suppose i have the following code:

def myVar = 10;
The lexer will split that into token like this:

def -> keyword
myVar -> Identifier
= -> Operator
10 -> Number
That's basically as far as i understand what a lexer does. How can i translate the tokens to a language like Javascript?? From what i understand i need to write a Parser class. But i couldn't find any info on what that class exactly does.

So what is exactly the next step i have to take?