definition module lex
-import Data.Either
+from Data.Either import :: Either
:: Token :== (Int, TokenValue)
:: TokenValue
import StdFile
import StdBool
-import lex
import parse
+import lex
//Start :: *World -> (ParserOutput, *World)
-Start w
-# (out, w) = stdio w
-# (toparse, out) = readEntireFile out
-# (_, w) = fclose out w
-= (lexer toparse, w)
+Start = ""
+//Start w
+//# (out, w) = stdio w
+//# (toparse, out) = readEntireFile out
+//# (_, w) = fclose out w
+//= (lexer toparse, w)
/*
Start :: *World -> (ParserOutput, *World)
Start w
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
+ Module
+ Name: yard
+ Dir: {Project}
+ Compiler
+ NeverMemoryProfile: False
+ NeverTimeProfile: False
+ StrictnessAnalysis: True
+ ListTypes: StrictExportTypes
+ ListAttributes: True
+ Warnings: True
+ Verbose: True
+ ReadableABC: False
+ ReuseUniqueNodes: True
+ Fusion: False
Module
Name: StdArray
Dir: {Application}/lib/StdEnv
definition module parse
-import lex
+from Data.Either import :: Either
+
+from lex import :: LexerOutput, :: Token, :: TokenValue
:: ParserOutput :== Either String AST
:: AST = If | While //stub
-:: Error = ParseException
parse :: LexerOutput -> ParserOutput
implementation module parse
import StdString
-import yard
+import Data.Either
+import yard
import lex
parse :: LexerOutput -> ParserOutput
parse (Left e) = Left ("Lexer error: " +++ e)
-parse (Right r) = Left "Parser not yet implemented"
\ No newline at end of file
+parse (Right r) = Left "Parser not yet implemented"
from Control.Monad import class Monad
from Control.Applicative import class Applicative, class Alternative
-:: Parser a b = Parser ([a] -> (Either Error b, [a]))
:: Error = ParseException
+:: Parser a b = Parser ([a] -> (Either Error b, [a]))
runParser :: (Parser a b) [a] -> (Either Error b, [a])
top :: Parser a a
satisfy :: (a -> Bool) -> Parser a a
item :: a -> Parser a a | Eq a
-list :: [a] -> Parser a [a] | Eq a
\ No newline at end of file
+list :: [a] -> Parser a [a] | Eq a
implementation module yard
import StdTuple
-from StdClass import Eq
+import StdClass
import Data.Functor
+import Data.Either
import Control.Monad
import Control.Applicative
from Data.Func import $
[x:xs] = (Right x, xs)
satisfy :: (a -> Bool) -> Parser a a
-satisfy f = one >>= \r -> if (f r) (return r) fail
+satisfy f = top >>= \r -> if (f r) (return r) fail
item :: a -> Parser a a | Eq a
item a = satisfy ((==)a)
list :: [a] -> Parser a [a] | Eq a
-list as = mapM item as
\ No newline at end of file
+list as = mapM item as