Syntax, Static Semantics, Semantics of a Language




As the title suggests 'Learning Python' & also MIT's 6.00x course's Revision, we hereby will go through every aspect of the course as quickly as possible along with some frequently used Python tools.

I take this opportunity as a part of the Final Exam preparation. So we'll include all exam oriented points from the courseware. Best way to revise is to recall examples rather than going through all theory stuff.

Here we go.


Lecture 1:

Three main points to note.

1. Knowledge: Declarative Knowledge & Imperative knowledge.
  • Declarative knowledge is statement of facts.
    • for eg: π = 3.14. Its a fact.
  • Imperative knowledge is the method on how you reached to that fact.
    • for eg:  π = circumference of any circle/diameter of that circle

2. Computer Program: Fixed Computer Program & Stored Computer Program
  • Fixed CP computes precisely only computation
    • for eg: while playing computer games a missile tracks you down if you fly over a 'Non-Civilian' area. That missile is an example of fixed computer program.
  • Stored CP  computes computes a set of instructions
    • for eg: a calculator
3. Aspects of Language:  Syntax, Static Semantics & Semantics
  • Syntax:
    • for eg: "Mouse Cat Dog" is not in a correct syntax as far as English language is concerned.
    • Same way there is a particular syntax in any other language. We'll consider Python syntaxes later as we proceed, as for now 3.2 + 3.2 is a syntactically valid statement.
  • Static Semantics: Whether syntactically valid statements have any meaning.
    • for eg: "I are big"... the syntax is correct, but there's a static semantic error that we know as grammatical error.
    • Similarly 3/'three' is a static semantic error in Python because int 3 is being divided by string 'three'
  • Semantics: There should not be more than one meaning associated with any statement because computer cannot figure out what meaning to consider then.
    • for eg: In English if I say "I'm having a friend for dinner" :p can be interpreted in two different ways. Such things should not, or I should say cannot happen in computer languages like Python.
Note:
This is a part of what I learn in an online Open Course Ware offered by MIT on edX
Its for my personal reference & also for those who have missed the course.
You too can enroll yourself on edX (if they are still offering the course MITx 6.00x)