Article View: comp.lang.functional
Article #795Re: "Off-side rule"
From: Kevin Hammond
Date: Thu, 24 Jan 1991 15:53
Date: Thu, 24 Jan 1991 15:53
24 lines
1858 bytes
1858 bytes
In article <2676@wn1.sci.kun.nl> eerke@cs.kun.nl (Eerke Boiten) writes: >In article <DTARDITI.91Jan22185718@LAMBDA.ERGO.CS.CMU.EDU> dtarditi@CS.CMU.EDU (David Tarditi) writes: >>A significant argument against the off-side rule is that it makes >>languages difficult to parse. The modern approach to parsing is to define >>the concrete syntax of a language using BNF and regular expressions. >>The BNF for the language should be defined so that the language can >>parsed using an LALR(1) parser. [..] > >This is only important for *prototyping* implementations of functional >languages in environments where no other parser generators than YACC are >available. Anyone who implemented a functional language, care to comment? For what it's worth, the Haskell off-side rule requires very few modifications to a yacc parser (one extra rule, I think). This assumes that the lexer is counting spaces. The lexer is rather more complicated, but can still be written using lex/C without too much trouble. The only real problems are keeping track of space in strings (which may extend across lines in Haskell) and remembering to adjust the space count when backtracking. Kevin -- This Signature Intentionally Left Blank. E-mail: kh@cs.glasgow.ac.uk
Technical Details
Message-ID:
<7534@vanuata.cs.glasgow.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!khReferences:
<22307@rouge.usl.edu> <1991Jan10.111559.12440@odin.diku.dk> <ACHA.91Jan11151418@DRAVIDO.CS.CMU.EDU> <293@smds.UUCP> <7415@vanuata.cs.glasgow.ac.uk> <DTARDITI.91Jan22185718@LAMBDA.ERGO.CS.CMU.EDU> <2676@wn1.sci.kun.nl>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!kh From: kh@cs.glasgow.ac.uk (Kevin Hammond) Newsgroups: comp.lang.functional Subject: Re: "Off-side rule" Message-ID: <7534@vanuata.cs.glasgow.ac.uk> Date: 24 Jan 91 15:53:50 GMT References: <22307@rouge.usl.edu> <1991Jan10.111559.12440@odin.diku.dk> <ACHA.91Jan11151418@DRAVIDO.CS.CMU.EDU> <293@smds.UUCP> <7415@vanuata.cs.glasgow.ac.uk> <DTARDITI.91Jan22185718@LAMBDA.ERGO.CS.CMU.EDU> <2676@wn1.sci.kun.nl> Reply-To: kh@cs.glasgow.ac.uk (Kevin Hammond) Organization: Comp Sci, Glasgow Univ, Scotland Lines: 24