COMPSCI 61A Lecture 21: Interpreters
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Computers can execute programs written in many different programming languages. Computers only deal w machine languages (0s and 1s) where statements are direct commands to the hardware. Programs written in languages like python are compiled or translated, into these machine languages from dis import dis dis stands for disassembler. Compilers are complicated, and the topic of future courses. Interpreters: programs that execute other programs written in a particular language. Python interpreter is a program written in c. To create a new programming language, we either need a: specification of the syntax and semantics of the language canonical implementation of either a compiler or interpreter for the language. Text --> parser --> expressions --> evaluator --> values. Take in text and perform syntactic analysis to convert into expressions the evaluator can understand. Read in expressions and perform semantic analysis to evaluate the expression and output corresponding values. Building an interpreter for a language is a lot of work.