See also Formal language, Programming language, Assembly (programming language)
https://github.com/aalhour/awesome-compilers – http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf – https://osmosianplainenglishprogramming.blog/
Context-free grammars and compilers: video
The compilation process usually involves these steps:
Lexical analysis
Stream of tokens
Syntax analysis (Parsing)
Parse tree
Semantic analysis
Parse tree (semantically verified)
Intermediate code generator
Three adress code
Code optimizer
Target code generator
Assembly code.
All these steps will also make use of a symbol table manager, and they communicate with an Error handler
Tool: lex
Converts string of characters into string of tokens, using, for instance a Regular expression. For instance in an anglebraic expression, all things that match [[a-z]\d]+
, where [a-z]
is a letter, and \d
is a digit, are converted into an "identifier" token, which is a fundamental unit in the grammar.
Tool: yacc
Create parse tree according to rules of some Grammar