What functions a lexer needs to provide?

I am making a lexer, don't tell me to not do because I already did most of it. Currently it makes an array of tokens and that's it. I would like to know, what functions the lexer needs to provide and a brief explanation of what each function needs to do. I'll accept the most complete list. An example function would be: **next**: Consume the current token and return it Also, should the lexer have the `expect` function or should the interpreter implement it? By the way, the lexer constructor accepts a string as argument and make the lexical analyses and store all the tokens in the "tokens" variable. The language is javascript, so I can't overload operators.

以上就是What functions a lexer needs to provide?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准