Where Rust Shines: Algebraic Types and Match Statements

Lexical Analysis and ASTs#

Recently I was going through Thorsten Ball’s “Writing An Interpreter in Go”. In this book, you create a basic interpreted language and write a lexer, parser, evaluator, and REPL for it.

A Lexer takes in source code and turns it into an intermediate representation, usually in the form of a string of tokens. This is called Lexical Analysis. A parser usually takes this stream of tokens and turns it into an Abstract Syntax Tree which is then evaluated and run.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论