@@ -30,11 +30,12 @@ data IState = IState { tt_ctxt :: Context,
30 idris_options :: IOption,
30 idris_options :: IOption,
31 idris_name :: Int,
31 idris_name :: Int,
32 idris_metavars :: [Name],
32 idris_metavars :: [Name],
33+ syntax_rules :: [Syntax],
33 imported :: [FilePath],
34 imported :: [FilePath],
34 idris_prims :: [(Name, ([E.Name], E.Term))]
35 idris_prims :: [(Name, ([E.Name], E.Term))]
37−idrisInit = IState emptyContext [] emptyContext "" defaultOpts 0 [] [] []
38+idrisInit = IState emptyContext [] emptyContext "" defaultOpts 0 [] [] [] []
39-- The monad for the main REPL - reading and processing files and updating
40-- The monad for the main REPL - reading and processing files and updating
40-- global state (hence the IO inner monad).
41-- global state (hence the IO inner monad).
@@ -134,7 +135,7 @@ data PDecl' t = PFix Fixity [String] -- fixity declaration
134 | PClauses Name [PClause' t] -- pattern clause
135 | PClauses Name [PClause' t] -- pattern clause
135 | PData (PData' t) -- data declaration
136 | PData (PData' t) -- data declaration
136 | PParams [(Name, PTerm)] [PDecl' t] -- params block
137 | PParams [(Name, PTerm)] [PDecl' t] -- params block
137− | PImport String
138+ | PSyntax Syntax
138 deriving Functor
139 deriving Functor
140data PClause' t = PClause Name t t [PDecl]
141data PClause' t = PClause Name t t [PDecl]
@@ -160,7 +161,7 @@ declared (PTy n t) = [n]
160declared (PClauses n _) = [] -- not a declaration
161declared (PClauses n _) = [] -- not a declaration
161declared (PData (PDatadecl n _ ts)) = n : map fst ts
162declared (PData (PDatadecl n _ ts)) = n : map fst ts
162declared (PParams _ ds) = concatMap declared ds
163declared (PParams _ ds) = concatMap declared ds
163−declared (PImport _) = []
164+-- declared (PImport _) = []
165-- High level language terms
166-- High level language terms
@@ -198,6 +199,13 @@ data DSL = DSL { dsl_bind :: Name,
198 dsl_return :: Name }
199 dsl_return :: Name }
199 deriving Show
200 deriving Show
202+data Syntax = Rule [SSymbol] PTerm
205+data SSymbol = Keyword Name
201initDSL = DSL (UN ["io_bind"]) (UN ["io_return"])
209initDSL = DSL (UN ["io_bind"]) (UN ["io_return"])
203data SyntaxInfo = Syn { using :: [(Name, PTerm)],
211data SyntaxInfo = Syn { using :: [(Name, PTerm)],
@@ -458,5 +466,6 @@ dumpDecl (PTy n t) = "tydecl " ++ show n ++ " : " ++ showImp True t
458dumpDecl (PClauses n cs) = "pat\t" ++ showSep "\n\t" (map (showCImp True) cs)
466dumpDecl (PClauses n cs) = "pat\t" ++ showSep "\n\t" (map (showCImp True) cs)
459dumpDecl (PData d) = showDImp True d
467dumpDecl (PData d) = showDImp True d
460dumpDecl (PParams ns ps) = "params {" ++ show ns ++ "\n" ++ dumpDecls ps ++ "}\n"
468dumpDecl (PParams ns ps) = "params {" ++ show ns ++ "\n" ++ dumpDecls ps ++ "}\n"
469+dumpDecl (PSyntax syn) = "syntax " ++ show syn
461−dumpDecl (PImport i) = "import " ++ i
470+-- dumpDecl (PImport i) = "import " ++ i