What's a Programming Language?What's a Language???Example LanguagesProgramming Language DesignProgramming Language DesignProgramming Language Designldots Programming Language Designldots Programming Language Designldots Programming Language Designldots Programming Language Designldots Goals of Programming Language DesignGoals of Programming Language Designldots Goals of Programming Language Designldots Compilers and LanguagesCompilers and LanguagesCompilers and Languagesldots History of Procedural LanguagesGoals of Language DesignSimplicityExpressivenessWell-defined descriptionWell-defined descriptionldots Well-defined descriptionldots Well-defined descriptionldots Well-defined descriptionldots Reliability/SafetyReliability/Safetyldots Reliability/Safetyldots Fast TranslationEfficient Object CodeOrthogonalityOrthogonalityldots Orthogonality: Order of DeclarationOrthogonality: Order of Declarationldots Orthogonality: Order of Declarationldots Orthogonality: Order of Declarationldots Orthogonality: Order of Declarationldots Orthogonality: Order of Declarationldots First Class CitizenshipFirst Class: Procedure Nestingldots First Class: Procedure Nestingldots First Class: Procedure Nestingldots Transparent Data TypesMachine Independence/PortabilityMachine Independence/Portabilityldots VerifiabilityVerifiability: Design by ContractConsistency with Familiar NotationsUniformityUniformityldots Support for Programming-In-The-LargeProgramming-In-The-Largeldots Programming-In-The-Largeldots Programming-In-The-Largeldots Support for Information HidingSupport for Information Hidingldots ExtensibilityExtensibilityldots Software Engineering by Language DesignPreventing interferencePreventing interferencePreventing illegal operationsPreventing illegal operationsPreventing RedundancyPreventing RedundancyProviding FlexibilityProviding FlexibilityError HandlingError HandlingControl FlowControl FlowUser-defined Types and OperationsUser-defined Types and OperationsMemory ManagementMemory ManagementSpecificationSpecificationSummaryReferencesedtxt {Homework}FORTRANThe First Major LanguageThe First CompilerThe First Compilerldots The First Compilerldots The First Compilerldots The First Compilerldots The First Compilerldots The First Compilerldots The First Compilerldots520 —Spring 2008 — 1CSc 520Principles of ProgrammingLanguages1 : IntroductionChristian [email protected] of Computer ScienceUniversity of ArizonaCopyrightc 2008 Christian Collberg[1]520 —Spring 2008 — 1What’s a Programming Language?[2]520 —Spring 2008 — 1What’s a Language???A formal language is a notation for preciselycommunicating ideas.By formal we mean that we know exactly which“sentences” belong to the language and that everysentence has a well-defined meaning.A language is defined by specifying its syntax andsemantics.The syntax describes how words can be formed intosentences. The semantics describes what thosesentences mean.[3]520 —Spring 2008 — 1Example LanguagesEnglish is a natural, not a formal language. ThesentenceMany missiles have many warheads.has multiple possible meanings.Programming languages: FORTRAN, LISP, Java,C++,...Text processing languages: LATEX, troff,...\begin{slide}{Example Languages}\begin{itemize}\item English is a \highlightbox{natural}, not a formallanguage. The sentence\end{itemize}\end{slide}Specification languages: VDM, Z, OBJ,...[4]520 —Spring 2008 — 1Programming Language Design[5]520 —Spring 2008 — 1Programming Language DesignProgramming language design has a long history.The first modern language (The “Plankalkül”) wasdesigned by Konrad Zuse in the 30s and 40s.The Language List(http://wuarchive.wustl.edu/doc/misc/lang-list.txt andhttp://cui.unige.ch/langlist) now contains some 2000entries.[6]520 —Spring 2008 — 1Programming Language Design...Languages are used for a number of applications:Programming (of course),Robot control,Specification (of compilers, safety-critical softwaresystems, etc.),Video game scripting,Database access,Typesetting, etc.[7]520 —Spring 2008 — 1Programming Language Design...Programming language design is a lot of fun. Lots ofpeople have felt the urge to design their own language.Programming language design is hard. Most languagedesigns arehorrible because:Most people don’t know enough languages to knowwhat is a good one and a bad one.[8]520 —Spring 2008 — 1Programming Language Design...Programming language design is a lot of fun. Lots ofpeople have felt the urge to design their own language.Programming language design is hard. Most languagedesigns arehorrible because:Most people don’t know enough languages to knowwhat is a good one and a bad one.Most people don’t know about the principles oflanguage design.[8]520 —Spring 2008 — 1Programming Language Design...Programming language design is a lot of fun. Lots ofpeople have felt the urge to design their own language.Programming language design is hard. Most languagedesigns arehorrible because:Most people don’t know enough languages to knowwhat is a good one and a bad one.Most people don’t know about the principles oflanguage design.Most people don’t know enough about compilerdesign.[8]520 —Spring 2008 — 1Programming Language Design...Programming language design is a lot of fun. Lots ofpeople have felt the urge to design their own language.Programming language design is hard. Most languagedesigns arehorrible because:Most people don’t know enough languages to knowwhat is a good one and a bad one.Most people don’t know about the principles oflanguage design.Most people don’t know enough about compilerdesign.Most people have no taste.[8]520 —Spring 2008 — 1Goals of Programming Language DesignThese are some of the principles language designers haveemployed:1. Simple2. Expressive3. Well-defined syntactic/semantic description4. Reliable/safe5. Easy to translate6. Efficient object code7. Orthogonal8. All language objects should be first class[9]520 —Spring 2008 — 1Goals of Programming Language Design..9. Transparent data types10. Machine independence and portability11. Verifiability12. Consistency with familiar notations13. Uniformity14. Extensibility15. Supports programming-in-the-large16. Supports information hiding[10]520 —Spring 2008 — 1Goals of Programming Language Design..Not all principles can/should be applied everywhere inevery language.Not all principles will apply to every type of language.Some principles may have
View Full Document