Created
September 22, 2020 05:06
-
-
Save okram/bd38ba9def65ab57a4ba8897b7b19280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val cType:Parser[Obj] = (anonType | boolType | realType | intType | strType | instType | (not(inst) ~> (lstType | recType)) | tokenType) ~ opt(quantifier) ^^ (x => x._2.map(q => x._1.q(q)).getOrElse(x._1)) | |
lazy val dtype:Parser[Obj] = cType ~ rep[Inst[Obj, Obj]](inst) ^^ (x => x._2.foldLeft(x._1.asInstanceOf[Obj])((x, y) => y.exec(x))) | anonTypeSugar | |
// the top definition of a type | |
lazy val aType:Parser[Obj] = opt(cType <~ Tokens.:<=) ~ dtype ^^ { | |
case Some(range) ~ domain => range <= domain | |
case None ~ domain => domain | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment