Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2909

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

Path csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From Roger L Costello <costello@mitre.org>
Newsgroups comp.compilers
Subject How do you create a grammar for a multi-language language?
Date Thu, 3 Mar 2022 13:57:55 +0000
Organization Compilers Central
Lines 19
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <22-03-004@comp.compilers> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 8bit
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="16318"; mail-complaints-to="abuse@iecc.com"
Keywords parse, question
Posted-Date 05 Mar 2022 16:50:21 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Thread-Topic How do you create a grammar for a multi-language language?
Thread-Index AdgvBM3tabuoXFasQLiTikka5cGndQ==
Content-Language en-US
Xref csiph.com comp.compilers:2909

Show key headers only | View raw


Hello Compiler Experts!

Suppose you are creating a grammar for a language that hosts other languages.
For example, the (parent) language hosts the regular expression language and
the XPath language. How do you create a grammar for a multi-language language?
I can imagine two approaches:

1. Create the grammar for the parent language and copy and paste into it the
grammars of the hosted languages. Copy-and-paste doesn't sound appealing.

2. Create a grammar just for the parent language. Then, create a parsing
pipeline: parse the input first with the grammar for the parent language, then
parse the input with the grammar for one hosted language, then parse the input
with the grammar for the second hosted language, and so forth. I have no idea
how this would work; e.g., how would an abstract syntax tree be constructed?

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

/Roger

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

How do you create a grammar for a multi-language language? Roger L Costello <costello@mitre.org> - 2022-03-03 13:57 +0000
  Re: How do you create a grammar for a multi-language language? Roger L Costello <costello@mitre.org> - 2022-03-05 22:29 +0000
    Re: How do you create a grammar for a multi-language language? "Kartik Agaram" <ak@akkartik.com> - 2022-03-05 16:55 -0800
    RE: How do you create a grammar for a multi-language language? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-03-06 15:37 +0200
      Re: How do you create a grammar for a multi-language language? gah4 <gah4@u.washington.edu> - 2022-03-06 14:36 -0800
        Re: How do you create a grammar for a multi-language language? gah4 <gah4@u.washington.edu> - 2022-03-06 16:50 -0800
      RE: How do you create a grammar for a multi-language language? Roger L Costello <costello@mitre.org> - 2022-03-06 23:32 +0000
  Re: How do you create a grammar for a multi-language language? gah4 <gah4@u.washington.edu> - 2022-03-05 21:10 -0800
    Re: How do you create a grammar for a multi-language language? "Robin Vowels" <robin51@dodo.com.au> - 2022-03-07 13:39 +1100
  Re: How do you create a grammar for a multi-language language? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-03-06 12:23 +0100
    Re: How do you create a grammar for a multi-language language? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-03-07 05:08 +0100
      Re: How do you create a grammar for a multi-language language? gah4 <gah4@u.washington.edu> - 2022-03-06 21:22 -0800
        Keywords and Reserved Words Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-03-08 21:46 +0200
          Re: Keywords and Reserved Words gah4 <gah4@u.washington.edu> - 2022-03-09 00:31 -0800
            Re: Keywords and Reserved Words "Robin Vowels" <robin51@dodo.com.au> - 2022-03-10 10:00 +1100
          Re: Keywords and Reserved Words "Robin Vowels" <robin51@dodo.com.au> - 2022-03-10 09:55 +1100
            Re: Keywords and Reserved Words in Fortran Thomas Koenig <tkoenig@netcologne.de> - 2022-03-10 07:07 +0000
          Re: Keywords and Reserved Words "Robin Vowels" <robin51@dodo.com.au> - 2022-03-10 11:59 +1100

csiph-web