flatparser
[clean-tests.git] / gengen / test.icl
1 module test
2
3 import StdEnv, StdGeneric
4
5 import Data.Func
6 import Data.Functor
7 import Data.List
8 import Data.Tuple
9 import Data.Bifunctor
10 import Data.Maybe
11 import Control.GenBimap
12 import Data.Either
13
14 import Data.GenType
15 import Data.GenType.CType
16 import Data.GenType.CParser
17
18 derive gType Either, T, R, Frac, Tr, Fix, Odd, Even, SR, List, Enum, NT, Blurp, EnumList, ER, CP
19
20 :: T a = T2 a Char
21 :: NT =: NT Int
22 :: SR = {f1 :: Int, f2 :: Bool, f3 :: Tr Either Bool, f4 :: Enum}
23 :: R a = {f1 :: ? (R a), f2 :: Bool, f3 :: T a, f4 :: Char -> Dynamic,
24 f5 :: [([#Int], [#Int!], [!Int!], [!Int], [Int!])],
25 f6 :: ({!Int}, {R Bool}, {#Char}, {32#Int}),/*({!Int}, {#Char}, {R Bool})*/
26 f7 :: {!Int}}
27 :: Tr m b= Tr (m Int b)
28 :: Frac a = (/.) infixl 7 a a | Flurp
29 :: Fix f = Fix (f (Fix f))
30
31 :: List a = Cons a (List a) | Nil
32
33 :: Blurp a = Blurp (List a) | Blorp
34
35 :: EnumList = ECons Enum EnumList | ENil
36
37 :: ER = {nat :: T Int, bool :: Bool}
38
39 :: CP = CLeft Int Bool | CRight Char Char
40
41 ////Start :: [String]
42 ////Start = foldr (\i c->print i ["\n":c]) [] $ catMaybes $ map gTypeToType $ flattenGType $ unBox t
43 //:: Pair a b = Pair a b
44 //instance == (Pair a b) | == a where (==) (Pair a1 _) (Pair a2 _) = a1 == a2
45 //instance < (Pair a b) | < a where (<) (Pair a1 _) (Pair a2 _) = a1 < a2
46 :: Odd a = Odd (Even a) | OddBlurp
47 :: Even a = Even (Odd a) | EvenBlurp
48 :: Enum = A | B | C
49 Start =
50 ( flatTypedef $ gTypeToType $ unBox t
51 , typedefs $ map (map gTypeToType) $ map (filter (not o isBasic)) $ flattenGType $ unBox t
52 , flatParser $ gTypeToType $ unBox t
53 )
54
55 //Start = typedefs //$ (\x->[[gTypeToType x]])
56 // $ map (/*filter (not o isBuiltin) o*/ catMaybes o map gTypeToType)
57 // $ (\x->[[x]])
58 // $ map (map gTypeToType)
59 // $ map (filter (not o isBasic))
60 // $ flattenGType
61 // $ unBox t
62
63
64 //t :: Box GType (?# Int)
65 //t :: Box GType (Maybe [Maybe (Either Bool String)])
66 //t :: Box GType ([SR], Enum, T Int, NT, Blurp Int)
67 //t :: Box GType [EnumList]
68 t :: Box GType (Either (Int, Char) (?CP))
69 //t :: Box GType (Odd Int, (), [Either (R (T *World)) (Frac Real)], Tr Either Bool, Fix Maybe)
70 t = gType{|*|}