Syntax and Semantics

Pamantasan ng Lungsod ng Muntinlupa NBP Reservation, City of Muntinlupa A Research study of Programming Language Specification Prepared and Submitted by: Cagande , Leonnesa Louise B. Gatchalian, Rizalina V. Rapsing, Romalyn S. BSCS – 4C Submitted to: Prof. Sahawi, Malik Abstract This research is about the components of program language in order to make a program. These are syntax, semantics and pragmatics. Introduction Programming language is a language intended for use by a person to express a process by which a computer can solve a problem.

It is use to make a program. Program is a formal description of characteristics required of a problem solution. Programs tell what should be not how to make it so. But first we have to learn and understand its component in order to write a correct program and to be able to predict the effect of execution of a program. Syntax, semantics and pragmatics are use to construct a program. These are the source codes and the meaning of it. Research Approach Syntax The structural rules of a language that determine the form of a program written in the language.

Is the form in which programs are written to give the rules of syntax for a programming language to tell how statements, declarations, and other language constructs are written. Syntactic Specification The primary purpose of syntax is to provide a notation for communication of information between programmers and programming language processor. Readability A program is readable if the underlying structure of the algorithm and data represented by the program is apparent from an inspection of the program text. A readable program is often said to be self documenting, it is understandable without any separate documentation.

Readability is enhanced by such language features is natural statement formats, structural statements, liberal use of keywords and noise words, provision for embedded comments, unrestricted length identifiers mnemonic operator symbols, free field formats, and complete data declarations. Writability The syntactic feature which make a program easy to write are often in conflict which those features which make it easy to read written ability is enhanced by use of concise and regular syntactic structures, while for readability a variety of more “verbose” constructs are helpful.

Implicit syntactic conventions that allow declarations and operation to be left unspecified make programs shorter and easier to write but harder to read. Other features advance both goals; for example, the use of structured statements simple natural statement formats, mnemonic operation symbols, and unrestricted identifiers usually make program writing easier by allowing the natural structure of the problem algorithms and data to be directly represented in the program.

Syntax is redundant if it communicates the same item of information in more than one way. Some redundancy is useful in programming language syntax because it makes a program easier to read and also allows more error checking to be done during translation. The disadvantage is that redundancy makes programs more verbose and thus harder to type. Most of the defaults rules for the meaning of language constructs are intended to reduce redundancy by eliminating explicit statement of meanings that can be inferred from the context. Ease of translation

Ease of translation relates to the needs of translator that processes the written program. The key to easy translation is regularity of structure. Lack of Ambiguity Ambiguity is a central problem in every language design. A language definition ideally provides a unique meaning for every syntactic construct that a programmer may write. An ambiguous construction allows two or more different interpretations. The problems of ambiguity usually arise not in the structure of individual program elements but in the interplay between different structures.

Ambiguities are usually resolved by one of the two techniques: either some syntactic modification is made to distinguish ambiguous constructions or some fixed interpretation is chosen, which may be dependent on the context, and the ambiguous syntactic construction is left intact. Semantics The meaning of the various languages constructs in the context of a given Program. The semantics of a programming language constructs are the various syntactic construct.

A manual for a programming language must define the meaning of each construct in the language, both alone and in construction with other language construct. A language provides a variety of different constructs, and both the language user and implementer require a precise definition of the semantics of each constructs. The programmer needs the definition so as to be able to write correct programs and to be able to predict the effect of execution of any program statement. The implementer needs the definition so as to be able to construct a correct implementation of the language.

Some Theoretical models and results. Many different methods for the formal definition of semantics have been developed. There are three general classes of such methods: 1. Operational Methods An operational definition of a programming language is a definition organized around a formal model of how programs in the language are executed on a virtual computer. It corresponds to an abstraction from our understanding of how languages are implemented. 2. Functional or denotational methods. A second class of semantic definition methods attempt to directly construct a definition of the function that each program in the language computes. This definition is built up hierarchically through definition of the function computed by each individual program construct. 3. Axiomatic Methods. * A third class of methods for semantic definition define the semantics of each syntactic construct in the language directly by giving an axiom or rule of inference tha may be used to deduce the effect of execution of that construct. Pragmatics

The pragma (pragmatic information) directive is part of the standard, but the meaning of any pragma depends on the software implementation of the standard that is used. Pragmas are used within the source program. Conclusion We learn that precise syntactic specification of a programming language from certain classes of grammars efficiently can be automatically generate the structure disclosed by a grammar is useful for translating source programs object code detecting errors allows a language; to evolve, to be developed iteratively and incrementally. nd it will enhance your understanding of programming in general and provide context for the features in object-oriented programming. We also learn that there a lot of ambiguities and interpretations in the language. Recommendation The researchers recommend that if you really want to developed a correct program you have to study rules in coding the source code which we called syntax and also its meaning the semantics.