1 / 26

Programming Language Design Concepts

Programming Language Design Concepts. Assist.Prof. Tugba Onal-Suzek. CENG2002. Instructor: Tugba Onal-Suzek Teaching Assistant : Erdem Turk Office: E1-10 Email : tugbas2001@yahoo.com Lecture Hours: Mon 9:30 - 12:20 (C105) Recitation Hours (C106): Thu:15:30-17:30

gjessica
Download Presentation

Programming Language Design Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Language Design Concepts Assist.Prof. Tugba Onal-Suzek

  2. CENG2002 • Instructor: Tugba Onal-Suzek • Teaching Assistant: Erdem Turk • Office: E1-10 • Email: tugbas2001@yahoo.com • Lecture Hours: Mon 9:30-12:20 (C105) • Recitation Hours (C106): Thu:15:30-17:30 • Course Web page:http://eng1.mu.edu.tr/~tugba/PL • Textbook: http://eng1.mu.edu.tr/~tugba/PL/ProgrammingLanguageDesignConceptsBook.pdf

  3. Grading • Midterm 30% • Quizes and Project 15 % • Attendance 5% • Attendance is mandatory. • If you miss 5 classes, you get 0 attendance points • If you miss 6 classes, your grade is TT • Final 50%

  4. Policies • Academichonesty is required in all work • We will talk about Plagiarism briefly today • Exams are closed book , but you are allowed 1 page cheat-sheet

  5. Tentative Syllabus • Programming Languages concepts and paradigms, syntax, semantics, pragmatics, history, Values(primitive only) • Values • Types: primitive, composite, recursive types, type systems • Dynamic vs static typing • Expressions • Expressions (continued) • Variables and Storage • Variables and Storage • Bindings and Scope • Lifetime of variables • Data Abstraction • Functional Programming with Python

  6. Which Programming Languages is BEST??? D • Is Bach or Mozart best composer? • Is Mazda or Mercedes best car? • Is Messi or Ronaldo best player? • Popularity of Programming Languages: • http://spectrum.ieee.org/computing/software/the-2016-top-programming-languages

  7. How do we classify life?Taxonomy!!! • Placing objects, e.g., life, into some type of order. E.g., the forelimb bones of a bird, bat, and cat

  8. How do we classify Programming Languages? • Procedural Languages? • C, Perl • Functional Languages? • Haskell, ML • Object Oriented Languages? • Java, C++ • Scripting Languages? • Javascript, Shell script • Mark-up Languages? • HTML, XML • They are languages, but are they really programming languages? Why? Why not? • Hybrid • Python, Ruby, Perl • Low-level vs High-level Languages? • Assembler vs Java

  9. Diversity of Programming Languages D • http://www.rosettacode.org/wiki/Hello_world/Text

  10. 1Introduction • Programming linguistics: • concepts and paradigms • syntax, semantics, and pragmatics • language processors. • Historical development of programming languages and paradigms.

  11. Programming linguistics • Programming linguistics is the study of programming languages (PLs). • This is by analogy with linguistics, the study of natural languages (NLs): • Both PLs and NLs have syntax (form) and semantics (meaning). • However, NLs are far broader, more expressive, and more subtle than PLs. • Also, linguists are limited to studying existing NLs. Computing scientists can design, specify, and implement new PLs.

  12. Properties • A PL must be universal– capable of expressing any computation. • A language without iteration or recursion is not universal. • A language of recursive functions (and nothing else) is universal. • A PL should be reasonably natural for expressing computations in its intended application area. • A PL must be implementable– it must be possible to run every program on a computer. • A PL should be capable of acceptably efficient implementation.

  13. Concepts • Concepts are building blocks of programs and PLs: • values and types • variables and storage • bindings and scope • procedural abstraction • data abstraction • generic abstraction (not covered in this course) • concurrency (not covered in this course).

  14. Paradigms • A paradigm is a style of programming, characterized by a particular selection of key concepts. • Imperative programming: variables, commands, procedures. • Object-oriented (OO) programming: objects, methods, classes. • Concurrent programming: processes, communication. • Functional programming: values, expressions, functions. • Logic programming: assertions, relations.

  15. Syntax, semantics, and pragmatics • A PL’s syntax is concerned with the form of programs: how expressions, commands, declarations, and other constructs must be arranged to make a well-formed program. • A PL’s semantics is concerned with the meaning of (well-formed) programs: how a program may be expected to behave when executed on a computer. • A PL’s pragmatics is concerned with the way in which the PL is intended to be used in practice. Pragmatics include the paradigm(s) supported by the PL. In this class, we are going to pay attention to semantics and pragmatics

  16. What determines a “good” language? • Formerly: Run-time performance • (Computers were more expensive than programmers) • Now: Life cycle (human) cost is more important • Ease of designing, coding • Debugging • Maintenance • Reusability • FADS

  17. Syntax, Semantics and Pragmatics Three aspects of language • Syntax is the required grammar and punctuation of the language • Compile-time errors are syntax errors • Semantics is all about meaning--what the statements do, what the programs do • Logic errors are semantic errors • Pragmatics has to do with what’s “good” and “bad” about a language or program

  18. Syntax examples • Java uses ; between statements;Python uses end of line between statements • Pascal uses begin…end to group statements;Perl and C uses { and } • Python uses print Java uses System.out.println THESE ARE SYNTACTIC DIFFERENCES. THE MEANINGS ARE IDENTICAL!! IF YOU DON’T GET SYNTAX RIGHT, YOUR PROGRAM WON’T COMPILE!!

  19. Semantics • Semantics has to do with the meaning of constructs in a language, and the meanings of programs written in that language • i.e. • C:do { x = 2*x; } while (x < 100);Pascal: repeat x := 2*x until x >= 100; Here you can notice that the sense of the test is different: C exits the loop when the condition becomes false Pascal exits the loop when it becomes true

  20. Semantic error example • $x=4; if ( $x=3) { print “YES!! $x is equal to 3 \n”; } • Swapping x=87 and y=37 x=y y=x

  21. Pragmatics • Pragmatics has to do with how well the language connects to the “real world” • Semantics supports pragmatics: some kinds of languages are better for some kinds of problems • The choice of a language should depend on pragmatic considerations

  22. Examples of pragmatics • C is fast because it does so little error checking • Java programs are less buggy because they spend so much time on error checks • Perl is good for CGI scripts because it has powerful tools for string processing • C++ is a better choice for me than Java because I know C++ better

  23. What is in this course? • Syntax, because you can’t do anything without it -- but it’s just an obstacle • Semantics, because this is what programming languages are all about, and where the real advances are made • Pragmatics, because you need some idea of the strengths and weaknesses of languages

  24. Language processors • A language processor is a system for processing programs either • executing them • or preparing them for execution. • Language processors include: • Compilers • C/C++ • Java (javac) • Interpreters • Perl • Python • Source-code editors • Atom • Notepad++ • Symbolic debuggers (i.e. gdb, valgrind)

  25. 1955 1960 Algol60 1965 PL/I Simula Algol68 1970 Pascal Smalltalk C 1975 Modula ML 1980 Ada83 1985 C++ OO imperative concurrent functional Historical development (1) Fortran Lisp Cobol

  26. 1980 Ada83 1985 C++ 1990 Haskell 1995 Ada95 Java 2000 C# 2005 OO imperative concurrent functional Historical development (2)

More Related