A compiler takes in programs of a language, produces programs of a language.
If we think deeper, what are required of such a function?
A mapping! Different parts of the program should map to the output.
To get this different parts we use
if, else, let.
Then we useto create an which has an interface we can work with.
We then haveto understand the of our source program, and finally use to output program in target language.
Common tools used
yacc, bison, (f)lex Not modern but stable. No inbuilt support for unicode.
Definite clause grammars https://www.metalevel.at/prolog/dcg https://github.com/indocomsoft/aoc2020/blob/main/16/ans.pl http://csci431.artifice.cc/notes/prolog-parsing.html
Parser combinators Combining various parsers.