Computers typically execute programs written in many different programming languages. Additionally, a group of people generally codes in many different languages and then stitches together the different languages somehow.
Machine Languages: statements are interpreted by the hardware itself
High-Level Languages: statements & expressions are interpreted by another program or compiled (translated) into another language.
A powerful form of abstraction is to define a new language that is tailored to a particular type of application or problem domain.
Type of application: Erlang was designed for concurrent programs. It has built-in elements for expressing concurrent communication. It is used, for example, to implement chat servers with many simulatenous connections.
Problem domain: The MediaWiki mark-up language was designed for generating static web pages. It has built-in elements for text formatting and cross-page linking. It is used, for example, to create Wikipedia pages. Or, in Denero's case, Wiktionary.
A programming language has:
To create a new programming language, you either need a:
The task of parsing a language involves coercing a string representation of an expression to the expression itself
A parser takes text and returns an expression: Text --> Lexical Analysis --> Tokens --> Syntactic Analysis --> Expression
Syntactic analysis identifies the hierarchical structure of an expression, which may be nested:
scheme_readsub-expressions and combine them
+: sum of arguments
*: product of arguments
-: if one argument, negate it; else, subtract the rest from the first
/: if one argument, invert it; else, divide the rest from the first
eval function computes the value of an expression, which is always a number. It is a generic function that dispatches on the type of expression.
For implementation and language semantics, see slide 120 in the lecture slides.