jeudi 3 août 2017

Lexer Parser confusion

I am developing a tool to create many GUI. Those GUI will be similar on many devise : Term, Html, AndroidApp. So I use a common base to create them.

I already coded a part of this tool. But I am thinking my code is really too difficult to understand. Maybe I need to use a design pattern like "decorator" to organize my code more clearly.

But the truly question is what I need to do and where ? I make some research into lexer and parser I didn't really understand what is the différence...

  • Lexer : Read the input to determine if the input is correct ?
  • Parser : Tokenize the input ?

Now my tool can already generate HTML language from a XML language. I need to generate Term interface. So I need to reuse the reader form the HTML. What I am coding right now ?

  • A Lexer to validate the input and send then to the specific parser to generate the GUI

  • Or a Lexer/Parser which send tokens to the specific "generator"(I don't know how to call it) to generate the GUI.

Sorry for my english, I am learning it...

Aucun commentaire:

Enregistrer un commentaire