Maintainer | CS 131, Programming Languages (Melissa O'Neill, Chris Stone, Ben Wiedermann) |
---|---|
Safe Haskell | Safe |
You do not need to edit this file, nor do you need to even read it, if you don't want. But you might find it interesting anyway.
- rwords :: [String]
- vname :: Parser String
- variable :: Parser Expr
- literal :: Parser Expr
- float :: Parser Double
- stringcontent :: Parser String
- numb :: Parser Integer
- expr :: Parser Expr
- relop :: Parser (Expr -> Expr -> Expr)
- cterm :: Parser Expr
- listop :: Parser (Expr -> Expr -> Expr)
- pterm :: Parser Expr
- plusminus :: Parser (Expr -> Expr -> Expr)
- mterm :: Parser Expr
- timesdivide :: Parser (Expr -> Expr -> Expr)
- aterm :: Parser Expr
- factor :: Parser Expr
- tuple_or_parenthetical :: Parser Expr
- list :: Parser Expr
- ifExpression :: Parser Expr
- recursiveLet :: Parser Expr
- letExpression :: Parser Expr
- vdecl :: Parser (String, Ty)
- ty :: Parser Ty
- bty :: Parser Ty
- caseExpression :: Parser Expr
- function :: Parser Expr
- data PreludeDecl
- prelude :: Parser [PreludeDecl]
- preludedecl :: Parser PreludeDecl
- parse :: Parser a -> String -> a
- parseNamed :: Parser a -> String -> String -> a
- parseFile :: Parser a -> String -> IO a
Documentation
Variable names A valid variable name starts with a lowercase letter and is not a reserved word.
stringcontent :: Parser String #
Parse the contents of a string literal
Parse a Moses expression * Relational operators are left-associative and have least precedence * List operators are right-associative and have next-highest precedence * Addition & subtraction are left-associative and have next-highest precedence * Multiplication & division are left-associative and have next-highest precedence * Unary negation has highest precedence
A factor is one of:
- a variable
- a literal value (int, real, string, or boolean)
- a parenthetical expression
- a tuple
- a list
- an if expression
- a recursive let expression
- a let expression
- a case expression on a list
- a function
tuple_or_parenthetical :: Parser Expr #
Parse a tuple-creating expression or a parenthetical expression
ifExpression :: Parser Expr #
Parse an if expression
recursiveLet :: Parser Expr #
Parse a recursive letrec expression
letExpression :: Parser Expr #
Parse a let expression
vdecl :: Parser (String, Ty) #
Parse a variable declaration (i.e., a variable name or a variable name + type)
Parse a type declaration Our grammar for Moses is somewhat ambiguous, it allows you to write fn x : INT -> x+1 and fn x : INT -> INT -> x+1 which means that we have to use a slightly more careful version of chainr1 which isn't so quick to think it's found a syntax error. Note that fn x : INT => x+1 is the preferred syntax.
caseExpression :: Parser Expr #
Parse a case expression
data PreludeDecl #
Eq PreludeDecl # | |
Ord PreludeDecl # | |
Show PreludeDecl # | |
prelude :: Parser [PreludeDecl] #
parseNamed :: Parser a -> String -> String -> a #