Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!ruuinf!kramer From: kramer@ruuinf.cs.ruu.nl (mark kramer) Newsgroups: comp.lang.misc Subject: Re: syntax and semantics Summary: The compiler doesn't need to "know" anything about semantics Keywords: parse automated syntax semantic Message-ID: <1257@ruuinf.cs.ruu.nl> Date: 13 Apr 89 14:05:06 GMT References: <2700@cuuxb.ATT.COM> Organization: Univ of Utrecht, Dept of CS Lines: 39 In article <2700@cuuxb.ATT.COM>, mmengel@cuuxb.ATT.COM (Marc W. Mengel) writes: | The reason this discussion has generated so much discussion | is that we have a clash between the theory-of-computation | folks and the pragmatic programmer types. .... | | The theoretical folks are talking about Context Free Grammars Surely, CFG's are not powerful enough for programming languages, but there are other types of grammars (type 0 or unrestricted grammars are as powerful as any conceivable computer program; Church's hypothesis for Turing Machines). | To the theoretical folks .... .... Semantics to them | is the meaning associatecd with the text, i.e. "i = j;" has the | effect of changing the value of the storage associated with the | variable "i". | | The pragmatic programmers are referring to syntax and semantics | based upon the tools they use to build compilers. .... | .... If our parser generators were powerfull enough | to really parse the languages involved, this definition would | coincide fairly well with the theoretical one; the code generated | for a given sequence of characters expresses the semantics of that | sequence. No, the code generated is just another string of symbols. The semantics is given by the execution on a target machine. Thus the definition above 'coincides fairly well' with the theoretical definition of *syntax*; code generation may be regarded as a purely *syntactical* transformation, so (substitute transform for check): | .... we get code | that is really checking syntax, but that our pragmatic programmers | have fallen into the habit of calling "semantic code", because | it wasn't built by the parser generator. A member(element) of {theoretic folks} INTERSECT {pragmatic programmers} Mark R. Kramer, Department of Computer Science, University of Utrecht Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands Phone: +31 - 30 - 531937 | UUCP : ...!hp4nl!ruuinf!kramer | INTERNET: kramer@cs.ruu.nl