- There are natural languages (e.g. English, French, German) and programming languages (e.g. Java, Scala, Python).
- Natural languages are usually Context Sensitive.
A word often has multiple meanings based on the context.
- Most programming languages are Context Free.
Noam Chomsky, a famous linguist, defined a hierarchy for languages and grammars.
Courses on Automata Theory and Formal Languages, Programming Languages, Compiling Techniques cover the Chomsky hierarchy and its applications
Basics of a Language
A language has
- Syntax (rules for forming well defined constructs)
- Semantics (meaning)
- Pragmatics (usage)
In our younger days, we had to study English Grammar book (by Wren and Martin) and Burmese Grammar book (by Saya U Pe Maung Tin).
Sample syntax for English :
- A sentence is a sequence of Subject (S), Verb (V) and Object (O).
- The cat killed the rat. (Example of active voice using the pattern SVO).
- The rat was killed by the rat. (Example of passive voice using the pattern OVS).
Myanmar Sar (Burmese Language)
- Burmese language has a structure similar to the Japanese language.
Both languages have a structure different to the English language.
- Sentences in Burmese usually have verbs at the end of a sentence,
Kyundaw Kyaung Thoe Thwa Thee (in Burmese)
is similar in structure to
Watashi was gakko e ikimasu (in Japanese)
Direct (word for word) translation into English would yield
I school to go
The equivalent grammatically correct English sentence would be
I go to school