Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: specifying semantics, was Formatting of Language LRMs Date: Fri, 04 Jul 2014 08:51:24 +0200 Organization: Compilers Central Lines: 42 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-07-011@comp.compilers> References: <14-06-010@comp.compilers> <14-06-023@comp.compilers> <14-06-025@comp.compilers> <14-06-027@comp.compilers> <14-06-030@comp.compilers> <14-06-031@comp.compilers> <14-07-003@comp.compilers> <14-07-006@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1404483930 72353 2001:470:1f07:1126:0:676f:7373:6970 (4 Jul 2014 14:25:30 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 4 Jul 2014 14:25:30 +0000 (UTC) Keywords: syntax, semantics, comment Posted-Date: 04 Jul 2014 10:25:30 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 3227 X-Received-Body-CRC: 2723087887 Xref: csiph.com comp.compilers:1301 Stefan Monnier schrieb: >> What is conventionally called "syntax" is an artifact of the compiler >> technology (or maybe of specification technology, see below): > > I disagree here. It is no accident. Same as the split between > lexical and syntactic analysis, the division between syntax and > (static) semantics is an engineering issue: specifying a language is a > fairly large amount of work, so you want to split it into simpler > parts. I don't know of any *general* formal description of lexical analysis, that would allow to e.g. describe Fortran and Algol (or C) lexing at the same time. In an experiment with an scannerless parser a problem with whitespace popped up, where whitespace sometimes is required to separate keywords from identifiers, sometimes is optional: Fortran: D O I = ... Pascal: if x ... C: int i ... Just in the Fortran example neither a longest nor a shortest match lexer is a solution. Do we have to exclude Fortran (and C) as context sensitive languages then? But what would be the benefit of an description formalism, that only is applicable to new languages, whose syntax and semantics can (must!) be described using just that formalims? In the case of the scannerless parser experiment the grammar size exploded, when the handling of whitespace was added. Also the well known "dangling else" problem can be solved only at the expense of a bigger grammar, which then may still be readable by a compiler generator, but not by humans any more. Such problems suggest to me that the design of a language starts with the design of an appropriate description formalism. But which formalism could be used to describe *that* formalism? DoDi [You can scan Fortran with longest match, but the things you're matching for are very context dependent. I've done it. I agree that it's unlikely we'll find a general model for different languages. -John]