Javascript to Elm

21: Building a compiler. Part 2

Informações:

Sinopsis

  Parsing Technical details of Meow’s parser Two main ways to tackle parsing top-down building the root node of the AST and then working downward and out When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called top-down parsing. bottom-up goes the other way. lol. As the name suggests, bottom-up parsing starts with the input symbols and tries to construct the parse tree up to the start symbol. Within this are a few variations. Meow will be a recursive descent parser top down operator precedence, called the “Pratt parser”, after Vaughan Pratt Parse Generator Dude, I know, well I didn’t know, but now I vaguely know. Sort of defeats the purpose of learning to just use the off the self parse generator. The actual parsing… starting with ‘let’ valid Meow code let x = 10; let y = 15; let add = fn(a,b){ return a + b; } Statements and Expressions Simply put, expressions produce values - statements don’t