Re: How do you create a grammar for a multi-language language?

gah4 <gah4@u.washington.edu>
Sun, 6 Mar 2022 21:22:17 -0800 (PST)

          From comp.compilers

Related articles
[3 earlier articles]
Re: How do you create a grammar for a multi-language language? gah4@u.washington.edu (gah4) (2022-03-05)
Re: How do you create a grammar for a multi-language language? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-03-06)
Re: How do you create a grammar for a multi-language language? gah4@u.washington.edu (gah4) (2022-03-06)
Re: How do you create a grammar for a multi-language language? gah4@u.washington.edu (gah4) (2022-03-06)
Re: How do you create a grammar for a multi-language language? robin51@dodo.com.au (Robin Vowels) (2022-03-07)
Re: How do you create a grammar for a multi-language language? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-03-07)
Re: How do you create a grammar for a multi-language language? gah4@u.washington.edu (gah4) (2022-03-06)
Keywords and Reserved Words christopher.f.clark@compiler-resources.com (Christopher F Clark) (2022-03-08)
Re: Keywords and Reserved Words gah4@u.washington.edu (gah4) (2022-03-09)
Re: Keywords and Reserved Words robin51@dodo.com.au (Robin Vowels) (2022-03-10)
Re: Keywords and Reserved Words robin51@dodo.com.au (Robin Vowels) (2022-03-10)
Re: Keywords and Reserved Words robin51@dodo.com.au (Robin Vowels) (2022-03-10)
Re: Keywords and Reserved Words in Fortran tkoenig@netcologne.de (Thomas Koenig) (2022-03-10)
| List of all articles for this month |

From: gah4 <gah4@u.washington.edu>
Newsgroups: comp.compilers
Date: Sun, 6 Mar 2022 21:22:17 -0800 (PST)
Organization: Compilers Central
References: 22-03-004 22-03-009 22-03-015
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="15313"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, design
Posted-Date: 07 Mar 2022 13:04:25 EST
In-Reply-To: 22-03-015

On Sunday, March 6, 2022 at 8:43:43 PM UTC-8, Hans-Peter Diettrich wrote:


(snip)
> My conclusion:
> A single (formal) grammar can not contain multiple languages. Unless you
> specify that e.g. statements and expressions in a programming language
> shall be considered subject to different languages. Such nitpicking is
> not worth further thoughts :-(


It would be complicated for compiled languages.


TeX allows one to change, character by character in the input, which characters
are letters, and so used in a control sequence name.


LaTeX macros, to allow for internal names that don't conflict with any
user defined names, puts an @ sign in them, after changing @ to a letter.
Then, just before going into user code, changes @ back to not a letter.
(Specifically, it is other.) The lexer can't read too far ahead, as the character
codes might change at any time.


It is also interesting to see how languages without reserved
words, keep track of which words have the keyword meaning,
and which are ordinary names.
[Back in the 1970s there were a bunch of extendible languages like EL/1 and
IMP72 where you could add and change syntax on the fly. They all died since
it meant that in practice no two programs were written in the same language
and they were unreadable. Now we have overloading so you understand the
syntax but you don't know what it means. -John]



Post a followup to this message

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