I need to write a lexer and a parser for a given grammar (I need to handcraft it not with generators). I have done a lot of research but I still can't figure out how to code it.
For example I have (grammar in EBNF):
<Letter> ::= [A-Za-z]
<IntegerLiteral> ::=<Digit> { <Digit> }
Does this need to be defined in the lexer or in the parser? And how?
I know that a lexer should read a file character by character and output tokens then these tokens are passed to the parser to create the parse tree however I am getting stuck in the coding.