Rohini 60290315053
Rohini 60290315053
Syntax: the form or structure of the expressions, statements, and program units.
In a programming language, Syntax defines the rules that govern the structure and
arrangement of keywords, symbols, and other elements. Syntax doesn't have any relationship with
the meaning of the statement; it is only associated with the grammar and structure of the
programming language.
A line of code is syntactically valid and correct if it follows all the rules of syntax. Syntax
does not have to do anything with the meaning of the statement. Syntax errors are encountered
after the program has been executed.
Some examples of syntax errors include missing semicolons in C++, undeclared variables
in Java, although such errors are easy to catch.
Programming languages are less accommodating to syntax errors. Syntax determines how
we organize the elements in our code to make it legible to the computer. If there’s a syntax error,
the computer might not be able to read it.
Semantics refers to the meaning of the associated line of code and how they are executed
in a programming language. Hence, semantics helps interpret what function the line of
code/program is performing.
Semantic errors are encountered and handled during runtime of the program execution. If
there is any semantic error and even when the statement has correct syntax, it wouldn't perform
the function that was intended for it to do. Thus, such errors are difficult to catch.
Syntax can vary quite a bit between languages. Python is clearly simpler than Java and
C++. This is because Python was designed to read like a human language. It doesn’t take much
time to learn Python well enough that you can read a program and understand basically what it’s
doing. Here are a few specific ways that Python syntax is simpler than Java and C++.
Python doesn’t require users to declare variable types, while Java and C++ do.
These similarities can be really helpful when trying to learn a new language. If you’re proficient
in Java and you’re trying to learn C++, or vice versa, you’ll encounter some familiar elements that
will streamline the process.
Terminologies
index = 2 * count + 17
Recognizers
A recognition device reads input strings over the alphabet of the language and
decides whether the input strings belong to the language
Generators –