Nested case statements in SML

后端 未结 3 891
深忆病人
深忆病人 2021-02-19 00:03

This is more of a stylistic question than anything else. Given the following piece of code:

case e1 of                    (* datatype type_of_e1  = p1 | p2 *)
           


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 00:56

    No. The syntactic rules in the Definition of Standard ML state that the match arms of a case expression attempt to maximally consume potential clauses. And since there's no "end case" or similar marker in the language, the parser will merrily eat each of the "| pat => exp" clauses that you feed it until it sees something that terminates a list of match clauses.

提交回复
热议问题