checkpoint
This commit is contained in:
16
eg/ex.newt
16
eg/ex.newt
@@ -1,9 +1,21 @@
|
|||||||
|
-- comment with double hyphen, takes precedence over operators
|
||||||
module Ex
|
module Ex
|
||||||
-- comment
|
-- imports not implemented yet
|
||||||
|
import Foo
|
||||||
|
-- inductive data type declaration (not supported in language yet)
|
||||||
data Bool : Type where
|
data Bool : Type where
|
||||||
True : Bool
|
True : Bool
|
||||||
False : Bool
|
False : Bool
|
||||||
|
|
||||||
|
-- claim
|
||||||
id : a -> a
|
id : a -> a
|
||||||
id = \ a => a
|
-- declaration
|
||||||
|
id = \ a => a * a + 2 * (3 + x)
|
||||||
|
|
||||||
|
-- this is complicated with patterns because we need to group stuff together.
|
||||||
|
-- I really should make a simple grammar
|
||||||
|
|
||||||
|
-- I want to put this on ice, there is so much to do before patterns..
|
||||||
|
|
||||||
|
blah : Either a a -> a
|
||||||
|
blah = \ x => let x = 1 in x * x
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ parseDecl = parseImport <|> parseSig <|> parseDef <|> parseData
|
|||||||
export
|
export
|
||||||
parseMod : Parser Module
|
parseMod : Parser Module
|
||||||
parseMod = do
|
parseMod = do
|
||||||
keyword "module"
|
sameLevel $ keyword "module"
|
||||||
name <- ident
|
name <- ident
|
||||||
-- probably should be manySame, and we want to start with col -1
|
-- probably should be manySame, and we want to start with col -1
|
||||||
-- if we enforce blocks indent more than parent
|
-- if we enforce blocks indent more than parent
|
||||||
|
|||||||
Reference in New Issue
Block a user