Skip to content

Commit

Permalink
Remove peculiar FFI syntax.
Browse files Browse the repository at this point in the history
The only remnant is the original weird `export` syntax of the
`effectively` compiler.
  • Loading branch information
blynn committed Feb 9, 2023
1 parent a459e11 commit 5c4ce92
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 88 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ reply.c: precisely inn/System.hs $(REPLYHS) inn/reply-native.hs; (cat inn/System

doh.c: precisely $(REPLYHS) inn/reply-wasm.hs inn/SystemWasm.hs; (cat inn/SystemWasm.hs $(REPLYHS) inn/BasePrecisely.hs inn/SystemWasm.hs ; echo '|]'; echo -n "ffiList = "; ./precisely ffis < inn/SystemWasm.hs; cat inn/reply-wasm.hs) | ./precisely wasm > $@

#doh.c: precisely $(REPLYHS) inn/reply-wasm.hs inn/SystemWasm.hs; (cat $(REPLYHS) inn/BasePrecisely.hs inn/SystemWasm.hs ; echo '|]'; cat inn/reply-wasm.hs) | ./precisely wasm > $@

doh.o:doh.c;$(WCC) $^ -c -o $@
doh.wasm:doh.o;$(WLD) --initial-memory=41943040 --global-base=0 $^ -o $@
doh.html:doh.txt menu.html;cobble mathbook menu $<
Expand All @@ -54,7 +52,8 @@ $(call party,multiparty.c,party,Base0 System Ast Map Parser Kiselyov Unify RTS T
$(call party,party1.c,multiparty,Base0 System Ast1 Map Parser1 Kiselyov Unify1 RTS Typer1 party)
$(call party,party2.c,party1,Base1 System Ast2 Map Parser2 Kiselyov Unify1 RTS1 Typer2 party1)
$(call party,crossly.c,party2,Base1 System Ast3 Map Parser3 Kiselyov Unify1 RTS2 Typer3 party2)
$(call party,precisely.c,crossly,BasePrecisely System AstPrecisely Map ParserPrecisely Kiselyov Unify1 RTSPrecisely TyperPrecisely precisely)
$(call party,slowprecisely.c,crossly,BasePrecisely System AstPrecisely Map ParserPrecisely Kiselyov Unify1 RTSPrecisely TyperPrecisely precisely)
$(call party,precisely.c,slowprecisely,BasePrecisely System AstPrecisely Map ParserPrecisely Kiselyov Unify1 RTSPrecisely TyperPrecisely precisely)

$(call party,check.c,precisely,BasePrecisely System AstPrecisely Map ParserPrecisely Kiselyov Unify1 RTSPrecisely TyperPrecisely precisely)

Expand Down
16 changes: 8 additions & 8 deletions assembly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
ffi "getargcount" getArgCount :: IO Int;
ffi "getargchar" getArgChar :: Int -> Int -> IO Char;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;
foreign import ccall "getargcount" getArgCount :: IO Int;
foreign import ccall "getargchar" getArgChar :: Int -> Int -> IO Char;

class Functor f where { fmap :: (a -> b) -> f a -> f b };
class Applicative f where
Expand Down Expand Up @@ -478,15 +478,15 @@ instDecl r = tok "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* tok "=>")) <|> pure [])
<*> conId <*> inst <*> (tok "where" *> (coalesce <$> braceSep (def r))));

ffiDecl = tok "ffi" *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

tops precTab = sepBy
( adt
<|> classDecl
<|> instDecl (expr precTab 0)
<|> ffiDecl
<|> tok "foreign" *>
( tok "import" *> var *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType))
<|> tok "export" *> var *> (addExport <$> litStr <*> var)
)
<|> addDefs . coalesce <$> sepBy1 (def $ expr precTab 0) (spch ';')
<|> tok "export" *> (addExport <$> litStr <*> var)
) (spch ';') <* (spch ';' <|> pure ';');
program = parse $ sp *> (((":", (5, RAssoc)):) . concat <$> many fixity) >>= tops;

Expand Down
2 changes: 1 addition & 1 deletion e4096.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
foreign import ccall "putchar" putChar :: Int -> IO Int;
class Eq a where { (==) :: a -> a -> Bool };
instance Eq Int where { (==) = intEq };
class Ord a where { (<=) :: a -> a -> Bool };
Expand Down
2 changes: 1 addition & 1 deletion effectively.hs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ instDecl r = keyword "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* want op "=>")) <|> pure [])
<*> conId <*> inst <*> (keyword "where" *> braceSep (def r)));

ffiDecl = keyword "ffi" *>
ffiDecl = keyword "foreign" *> keyword "import" *> var *>
(FFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

eqn r = Def <$> (keyword "export" *> (Just <$> litStr) <|> pure Nothing) <*> def r;
Expand Down
12 changes: 6 additions & 6 deletions guardedly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;

class Functor f where { fmap :: (a -> b) -> f a -> f b };
class Applicative f where
Expand Down Expand Up @@ -448,15 +448,15 @@ instDecl r = tok "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* tok "=>")) <|> pure [])
<*> conId <*> inst <*> (tok "where" *> (coalesce <$> braceSep (def r))));

ffiDecl = tok "ffi" *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

tops precTab = sepBy
( adt
<|> classDecl
<|> instDecl (expr precTab 0)
<|> ffiDecl
<|> tok "foreign" *>
( tok "import" *> var *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType))
<|> tok "export" *> var *> (addExport <$> litStr <*> var)
)
<|> addDefs . coalesce <$> sepBy1 (def $ expr precTab 0) (spch ';')
<|> tok "export" *> (addExport <$> litStr <*> var)
) (spch ';');
program' = sp *> (((":", (5, RAssoc)):) . concat <$> many fixity) >>= tops;

Expand Down
2 changes: 1 addition & 1 deletion hilsys.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ infixl 2 ||
infixl 1 >> , >>=
infixr 0 $
ffi "putchar" putChar :: Int -> IO Int
foreign import ccall "putchar" putChar :: Int -> IO Int
class Functor f where fmap :: (a -> b) -> f a -> f b
class Applicative f where
Expand Down
4 changes: 0 additions & 4 deletions inn/RTSPrecisely.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Ast
import Kiselyov
import Map
import Parser

import Typer

import_qq_here = import_qq_here
Expand Down Expand Up @@ -511,9 +510,6 @@ void errchar(int c) {}
void errexit() {}
|]++)

allFFIs s =
fromList . concatMap (toAscList . ffiImports) . elems <$> singleFile s

warts opts ffis =
("typedef unsigned u;\n"++)
. libcWarts
Expand Down
2 changes: 1 addition & 1 deletion inn/Typer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rewritePats dcs = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase dcs v Tip [(p, b)]) x (zip at vt)
flip (foldr L) vs <$> rewriteCase dcs vh Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase dcs caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
2 changes: 1 addition & 1 deletion inn/Typer1.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rewritePats dcs = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase dcs v Tip [(p, b)]) x (zip at vt)
flip (foldr L) vs <$> rewriteCase dcs vh Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase dcs caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
2 changes: 1 addition & 1 deletion inn/Typer2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rewritePats dcs = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase dcs v Tip [(p, b)]) x (zip at $ tail vs)
flip (foldr L) vs <$> rewriteCase dcs (head vs) Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase dcs caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
2 changes: 1 addition & 1 deletion inn/Typer3.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ rewritePats searcher = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase searcher v Tip [(p, b)]) x (zip at $ tail vs)
flip (foldr L) vs <$> rewriteCase searcher (head vs) Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase searcher caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
2 changes: 1 addition & 1 deletion inn/TyperPrecisely.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rewritePats searcher = \case

scottCase q x = A (assertType (E $ Basic "I") q) x

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase searcher caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
2 changes: 2 additions & 0 deletions inn/precisely.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ objDump s = do
. shows (_mem m)
. ("\n })\n"++)

allFFIs s = fromList . concatMap (toAscList . ffiImports) . elems <$> singleFile s

main = getArgs >>= \case
"obj":_ -> interact $ either id ($ "") . objDump
"matrix":_ -> interact $ dumpWith dumpMatrix
Expand Down
14 changes: 7 additions & 7 deletions lonely.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;

class Functor f where { fmap :: (a -> b) -> f a -> f b };
class Applicative f where
Expand Down Expand Up @@ -434,16 +434,16 @@ instDecl r = keyword "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* want varSym "=>")) <|> pure [])
<*> conId <*> inst <*> (keyword "where" *> braceSep (def r)));

ffiDecl = keyword "ffi" *>
(addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

tops precTab = sepBy
( adt
<|> classDecl
<|> instDecl (expr precTab 0)
<|> ffiDecl
<|> keyword "foreign" *>
( keyword "import" *> var *>
(addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType))
<|> keyword "export" *> var *> (addExport <$> litStr <*> var)
)
<|> addDef <$> def (expr precTab 0)
<|> keyword "export" *> (addExport <$> litStr <*> var)
) (spch ';');
program' = sp *> (((":", (5, RAssoc)):) . concat <$> many fixity) >>= tops;

Expand Down
16 changes: 9 additions & 7 deletions marginally.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
ffi "getargcount" getArgCount :: IO Int;
ffi "getargchar" getArgChar :: Int -> Int -> IO Char;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;
foreign import ccall "getargcount" getArgCount :: IO Int;
foreign import ccall "getargchar" getArgChar :: Int -> Int -> IO Char;

class Functor f where { fmap :: (a -> b) -> f a -> f b };
class Applicative f where
Expand Down Expand Up @@ -361,7 +361,7 @@ integer = char '0' *> (char 'x' <|> char 'X') *> hexadecimal <|> decimal;
literal = Lit . Const <$> integer <|> Lit . ChrCon <$> tokChar <|> Lit . StrCon <$> tokStr;
varId = fmap ck $ liftA2 (:) small $ many (small <|> large <|> digit <|> char '\'') where
{ ck s = (if elem s
["ffi", "export", "case", "class", "data", "default", "deriving", "do", "else", "foreign", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", "module", "newtype", "of", "then", "type", "where", "_"]
["export", "case", "class", "data", "default", "deriving", "do", "else", "foreign", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", "module", "newtype", "of", "then", "type", "where", "_"]
then Reserved else VarId) s };
varSym = fmap ck $ (:) <$> sat (\c -> isSymbol c && c /= ':') <*> many (sat isSymbol) where
{ ck s = (if elem s ["..", "=", "\\", "|", "<-", "->", "@", "~", "=>"] then Reserved else VarSym) s };
Expand Down Expand Up @@ -767,8 +767,10 @@ topdecls = braceSep
( adt
<|> classDecl
<|> instDecl
<|> res "ffi" *> (addFFI <$> wantString <*> var <*> (res "::" *> _type))
<|> res "export" *> (addExport <$> wantString <*> var)
<|> res "foreign" *>
( res "import" *> var *> (addFFI <$> wantString <*> var <*> (res "::" *> _type))
<|> res "export" *> var *> (addExport <$> wantString <*> var)
)
<|> addDefs <$> defSemi
<|> fixity
);
Expand Down
14 changes: 6 additions & 8 deletions methodically.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ infixl 2 ||
infixl 1 >> , >>=
infixr 0 $

ffi "putchar" putChar :: Int -> IO Int
ffi "getchar" getChar :: IO Int
ffi "getargcount" getArgCount :: IO Int
ffi "getargchar" getArgChar :: Int -> Int -> IO Char
foreign import ccall "putchar" putChar :: Int -> IO Int
foreign import ccall "getchar" getChar :: IO Int
foreign import ccall "getargcount" getArgCount :: IO Int
foreign import ccall "getargchar" getArgChar :: Int -> Int -> IO Char

libc = [r|#include<stdio.h>
static int env_argc;
Expand Down Expand Up @@ -376,7 +376,7 @@ integer = char '0' *> (char 'x' <|> char 'X') *> hexadecimal <|> decimal
literal = Lit . Const <$> integer <|> Lit . ChrCon <$> tokChar <|> Lit . StrCon <$> tokStr
varId = fmap ck $ liftA2 (:) small $ many (small <|> large <|> digit <|> char '\'') where
ck s = (if elem s
["ffi", "export", "case", "class", "data", "default", "deriving", "do", "else", "foreign", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", "module", "newtype", "of", "then", "type", "where", "_"]
["export", "case", "class", "data", "default", "deriving", "do", "else", "foreign", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let", "module", "newtype", "of", "then", "type", "where", "_"]
then Reserved else VarId) s
varSym = fmap ck $ (:) <$> sat (\c -> isSymbol c && c /= ':') <*> many (sat isSymbol) where
ck s = (if elem s ["..", "=", "\\", "|", "<-", "->", "@", "~", "=>"] then Reserved else VarSym) s
Expand Down Expand Up @@ -775,8 +775,6 @@ topdecls = braceSep
( res "import" *> var *> (addFFI <$> wantString <*> var <*> (res "::" *> _type))
<|> res "export" *> var *> (addExport <$> wantString <*> var)
)
<|> res "ffi" *> (addFFI <$> wantString <*> var <*> (res "::" *> _type))
<|> res "export" *> (addExport <$> wantString <*> var)
<|> addDefs <$> defSemi
<|> fixity *> pure id
)
Expand Down Expand Up @@ -940,7 +938,7 @@ rewritePats dcs = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase dcs v Tip [(p, b)]) x (zip at vt)
flip (foldr L) vs <$> rewriteCase dcs vh Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase dcs caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
16 changes: 8 additions & 8 deletions mutually.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
ffi "getargcount" getArgCount :: IO Int;
ffi "getargchar" getArgChar :: Int -> Int -> IO Char;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;
foreign import ccall "getargcount" getArgCount :: IO Int;
foreign import ccall "getargchar" getArgChar :: Int -> Int -> IO Char;

class Functor f where { fmap :: (a -> b) -> f a -> f b };
class Applicative f where
Expand Down Expand Up @@ -534,15 +534,15 @@ instDecl r = tok "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* tok "=>")) <|> pure [])
<*> conId <*> inst <*> (tok "where" *> (coalesce <$> braceSep (def r))));

ffiDecl = tok "ffi" *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

tops precTab = sepBy
( adt
<|> classDecl
<|> instDecl (expr precTab 0)
<|> ffiDecl
<|> tok "foreign" *>
( tok "import" *> var *> (addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType))
<|> tok "export" *> var *> (addExport <$> litStr <*> var)
)
<|> addDefs . coalesce <$> sepBy1 (def $ expr precTab 0) (spch ';')
<|> tok "export" *> (addExport <$> litStr <*> var)
) (spch ';') <* (spch ';' <|> pure ';');
program = parse $ sp *> (((":", (5, RAssoc)):) . concat <$> many fixity) >>= tops;

Expand Down
4 changes: 0 additions & 4 deletions mvp.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ Now that the syntax is slightly more pleasant:

* We support list comprehensions.

* To match GHC, we support `foreign import ccall` as well as `ffi`,
and `foreign export ccall` as well as `export`. In the next compiler,
we'll remove `ffi` and plain `export`.

We prepare to change `getChar` to match Haskell's, which throws an exception on
end of input. Up until now, ours simply calls the `getchar` function of C,
which returns -1 on end of input. Also, we would like Haskell's `isEOF` so we
Expand Down
2 changes: 1 addition & 1 deletion party.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ rewritePats dcs = \case
cs <- flip mapM vsxs \(a:at, x) -> (a,) <$> foldM (\b (p, v) -> rewriteCase dcs v Tip [(p, b)]) x (zip at vt)
flip (foldr L) vs <$> rewriteCase dcs vh Tip cs

patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y
patEq lit b x y = A (L "join#" $ A (A (A (V "if") (A (A (V "==") (E lit)) b)) x) $ V "join#") y

rewriteCase dcs caseVar tab = \case
[] -> flush $ V "join#"
Expand Down
16 changes: 8 additions & 8 deletions patty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ infixl 7 * , / , %;
infixl 6 + , -;
infixr 5 ++;
infixl 4 <*> , <$> , <* , *>;
infix 4 == , /= , <=;
infix 4 == , <=;
infixl 3 && , <|>;
infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
ffi "getchar" getChar :: IO Int;
foreign import ccall "putchar" putChar :: Int -> IO Int;
foreign import ccall "getchar" getChar :: IO Int;

data Bool = True | False;
ife a b c = case a of { True -> b ; False -> c };
Expand Down Expand Up @@ -514,16 +514,16 @@ instDecl r = keyword "instance" *>
(((wrap .) . Pred <$> conId <*> (inst <* want varSym "=>")) <|> pure [])
<*> conId <*> inst <*> (keyword "where" *> (coalesce <$> braceSep (def r))));

ffiDecl = keyword "ffi" *>
(addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType));

tops precTab = sepBy
( adt
<|> classDecl
<|> instDecl (expr precTab 0)
<|> ffiDecl
<|> keyword "foreign" *>
( keyword "import" *> var *>
(addFFI <$> litStr <*> var <*> (char ':' *> spch ':' *> _type aType))
<|> keyword "export" *> var *> (addExport <$> litStr <*> var)
)
<|> addDefs . coalesce <$> sepBy1 (def $ expr precTab 0) (spch ';')
<|> keyword "export" *> (addExport <$> litStr <*> var)
) (spch ';');
program' = sp *> (((":", (5, RAssoc)):) . concat <$> many fixity) >>= tops;

Expand Down
2 changes: 1 addition & 1 deletion q11.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ infixl 2 ||;
infixl 1 >> , >>=;
infixr 0 $;

ffi "putchar" putChar :: Int -> IO Int;
foreign import ccall "putchar" putChar :: Int -> IO Int;

class Eq a where { (==) :: a -> a -> Bool };
instance Eq Int where { (==) = intEq };
Expand Down
Loading

0 comments on commit 5c4ce92

Please sign in to comment.