Preview

Programming Language Comparison

Good Essays
Open Document
Open Document
3807 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Programming Language Comparison
Syntax This section does not cite any references or sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2013)
Syntactically, Pascal is much more ALGOL-like than C. English keywords are retained where C uses punctuation symbols – Pascal has and, or, and mod where C uses &&, ||, and % for example. However, C is actually more ALGOL-like than Pascal regarding (simple) declarations, retaining the type-name variable-name syntax. For example, C can accept declarations at the start of any block, not just the outer block of a function.
Semicolon use
Another more subtle difference is the type of delimiter used. In Pascal semicolons separate individual statements within a compound statement and also used to terminate a statement. They are also syntactically part of the statement itself in C (transforming an expression into a statement). This difference manifests itself primarily in two situations:
• there can never be a semicolon directly before else in Pascal whereas it is mandatory in C (unless a block statement is used)
• the last statement before an end is not required to be followed by a semicolon
A superfluous semicolon can be put on the last line before end, thereby formally inserting an empty statement.
Comments
In traditional C, there are only /* block comments */. This is only supported by certain Pascal dialects like MIDletPascal.
In traditional Pascal, there are { block comments } and (* block comments *). Modern Pascal, like Object Pascal (Delphi, FPC), as well as modern C implementations allow C++ style comments // comments
Identifiers and keywords
C and Pascal differ in their interpretation of upper and lower case. C is case sensitive while Pascal is not, thus MyLabel and mylabel are distinct names in C but identical in Pascal. In both languages, identifiers consist of letters and digits, with the rule that the first character may not be a digit. In C, the

You May Also Find These Documents Helpful