Re: Designing a Domain-specific language

bartc <bc@freeuk.com>
Tue, 23 May 2017 20:39:34 +0100

          From comp.compilers

Related articles
Designing a Domain-specific language dror.openu@gmail.com (2017-05-23)
Re: Designing a Domain-specific language bc@freeuk.com (bartc) (2017-05-23)
Re: Designing a Domain-specific language DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2017-05-24)
Re: Designing a Domain-specific language laguest9000@googlemail.com (lucretia9@lycos.co.uk) (2017-05-24)
Re: Designing a Domain-specific language dror.openu@gmail.com (2017-05-25)
Re: Designing a Domain-specific language bc@freeuk.com (bartc) (2017-05-27)
| List of all articles for this month |

From: bartc <bc@freeuk.com>
Newsgroups: comp.compilers
Date: Tue, 23 May 2017 20:39:34 +0100
Organization: virginmedia.com
References: 17-05-007
Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="63122"; mail-complaints-to="abuse@iecc.com"
Keywords: design
Posted-Date: 25 May 2017 10:58:26 EDT

On 23/05/2017 15:12, dror.openu@gmail.com wrote:
> I'm implementing right now a "compiler" for a DSL that used at my work, and I'd like to get your advice for a dilemma I have.
> One of the requirements at the begging was that the compiler should get an input only one file.
>
> But, it's changed and I asked to add two more capabilities. and they are:
> [ some sort of multiple input file ]


This depends on lots of things. Are you taking something that would have
been one big file, and simply allowing it to be split?


Do the STD common parts, something that would have been part of one
file, now have to be part of each of the multiple files?


How does each file know about what's in the other files, when it's
something not in those STD common included files?


One easy solution (assuming having to compile all the sources is not an
issue) might be to just load all the files into memory and combine them
into one file. Then compile as a single file, dealing with possible
multiple includes, or out-of-order references, if that would be a problem.


But it really depends on how this language works.


(All the compiler projects I do now aim to compile all modules of a
project together. Some will have a hierarchical module system and that
can help: there is one symbol table, with the whole program as the root,
and (as I do it with modules sharing a flat namespace), each source file
or module at the next level.


Below that, whatever is defined within each module. This however is the
symbol table tree, not the parse tree. Individual parse trees exist per
function. This is why it depends a great deal on the language.)




--
bartc


Post a followup to this message

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