Re: What is the semantics of a language?

luser droog <luser.droog@gmail.com>
Mon, 24 Jan 2022 11:39:11 -0800 (PST)

          From comp.compilers

Related articles
What is the semantics of a language? costello@mitre.org (Roger L Costello) (2022-01-22)
Re: What is the semantics of a language? luser.droog@gmail.com (luser droog) (2022-01-24)
Re: What is the semantics of a language? gah4@u.washington.edu (gah4) (2022-01-25)
Re: What is the semantics of a language? gneuner2@comcast.net (George Neuner) (2022-01-26)
Re: What is the semantics of a language? gah4@u.washington.edu (gah4) (2022-01-26)
Re: What is the semantics of a language? lkrupp@invalid.pssw.com.invalid (Louis Krupp) (2022-02-18)
| List of all articles for this month |
From: luser droog <luser.droog@gmail.com>
Newsgroups: comp.compilers
Date: Mon, 24 Jan 2022 11:39:11 -0800 (PST)
Organization: Compilers Central
References: 22-01-081
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="67370"; mail-complaints-to="abuse@iecc.com"
Keywords: semantics
Posted-Date: 24 Jan 2022 14:40:56 EST
In-Reply-To: 22-01-081

On Friday, January 21, 2022 at 9:24:11 PM UTC-6, Roger L Costello wrote:
> What is the semantics of a language?
>
> Section 3.4 of the Bison specification [1] has the answer:
>
> 3.4 Defining Language Semantics
>
> The grammar rules for a language determine only the syntax. The
> semantics are determined by the semantic values associated with
> various tokens and groupings, and by the actions taken when various
> groupings are recognized.
>
> Niklaus Wirth agrees with the Bison specification. In the introduction of his book, Compiler Construction, he says [2]:
>
> The translation process is now guided by the structure of the analysed
> text. The text is decomposed, parsed into its components according to
> the given syntax. For the most elementary components, their semantics
> is recognized, and the meaning (semantics) of the composite parts is
> the result of the semantics of their components. Naturally, the
> meaning of the source text must be preserved by the translation.
>
> Do you agree that that is the definition of the semantics of a language?


I think those are both good. Another perspective is view syntax vs. semantics
as the purview of different tools. A parser generator will handle the syntax but
you have to provide the semantics in some other form. Adopting a common
backend will handle semantics but you have to provide your own syntax analysis.
So I'd say the syntax is directed by the grammar, but the semantics is directed
by the resulting structure from a successful application of that syntax.


What it looks like vs. What to do about it


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.