Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007512OCamllexing and parsingpublic2017-03-29 17:562017-03-29 20:30
Assigned Togasche 
StatusresolvedResolutionno change required 
PlatformLinuxOSUbuntuOS Version16.04
Product Version4.04.0 
Target VersionFixed in Version 
Summary0007512: parsing bug for lazy expressions
DescriptionAccording to the language specification [^]

I should be able to write something like the following:

    # let v = lazy let s = "hello" in s ^ "world" ;;

However this is reported as a syntax error by the compiler.

On the other hand, the following is fine:

    # let v = lazy (let s = "hello" in s ^ "world") ;;

Is this a bug, or have I missed something?
Steps To ReproduceEnter the following in an interactive session:

let v = lazy let s = "hello" in s ^ "world" ;;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2017-03-29 20:30

The BNF grammar specifies the structure of the code, but it does not enforce the parenthesizing strategy -- this is specified by associativies and precedence rules that are not part of the more declarative BNF grammar. In this particular case, the current way grammar rules are organized in the parser rejects requires a bit more parenthesizing than what is strictly required for ambiguity rejection, but I believe that this should not be considered a bug -- at best, allowing the relaxed form could be a feature/tweak request. Given that the latter doesn't seem more readable for humans (and can easily be avoided in computer-generated code by adding parentheses around `lazy`), I marked this PR as "no change required".

- Issue History
Date Modified Username Field Change
2017-03-29 17:56 reuben.rowe New Issue
2017-03-29 20:30 gasche Note Added: 0017710
2017-03-29 20:30 gasche Status new => resolved
2017-03-29 20:30 gasche Resolution open => no change required
2017-03-29 20:30 gasche Assigned To => gasche

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker