mirror of
https://github.com/macocianradu/RosettaHaskellCompiler.git
synced 2026-03-18 21:10:07 +00:00
Made super mandatory. Everything extends Object
This commit is contained in:
@@ -40,7 +40,9 @@ spec = do
|
||||
|
||||
exps :: [Expression]
|
||||
exps = [
|
||||
-- 1
|
||||
InfixExp "+" (Int "1") (Parens (InfixExp "-" (Int "2") (Int "3"))),
|
||||
-- 2
|
||||
InfixExp "="
|
||||
(InfixExp "-"
|
||||
(InfixExp "-"
|
||||
@@ -52,17 +54,27 @@ exps = [
|
||||
(InfixExp "*" (Variable "g") (Variable "h"))
|
||||
(InfixExp "*" (Variable "i") (Variable "j")))
|
||||
(InfixExp "*" (Variable "k") (Variable "l"))),
|
||||
-- 3
|
||||
InfixExp "-" (InfixExp "+" (Variable "a") (Variable "b")) (InfixExp "*" (Variable "c") (InfixExp "^" (Variable "d") (Variable "e"))),
|
||||
-- 4
|
||||
InfixExp "-" (InfixExp "-" (InfixExp "-" (InfixExp "-" (InfixExp "-" (Int "1") (Int "2")) (Int "3")) (Int "4")) (Int "5")) (Int "6"),
|
||||
-- 5
|
||||
List [Int "1", Int "2", Int "3"],
|
||||
-- 6
|
||||
List [Int "1", InfixExp "+" (Int "2") (Int "3"), Variable "e"],
|
||||
-- 7
|
||||
Function "Function" [],
|
||||
-- 8
|
||||
Function "Function" [Variable "e"],
|
||||
-- 9
|
||||
Function "Function" [Int "3", InfixExp "+" (Int "3") (Int "2"), Variable "e"],
|
||||
-- 10
|
||||
IfElse (Function "Function" [InfixExp "+" (Int "2") (Int "3"), Variable "e"])
|
||||
(InfixExp "-" (InfixExp "+" (Variable "a") (Variable "b")) (InfixExp "*" (Variable "c") (InfixExp "^" (Variable "d") (Variable "e->x"))))
|
||||
(PrefixExp "not" (PostfixExp "exists" (Variable "a"))),
|
||||
-- 11
|
||||
IfSimple (List [Int "1", Function "Function" [Int "3"]]) (InfixExp "-" (InfixExp "-" (Int "1") (Int "2")) (InfixExp "*" (Int "3") (InfixExp "^" (Variable "a->b") (Variable "c")))),
|
||||
-- 12
|
||||
InfixExp "or" (Variable "a") (Variable "b")
|
||||
]
|
||||
|
||||
|
||||
@@ -36,42 +36,42 @@ types :: [Type]
|
||||
types = [
|
||||
MakeType {typeName = "Period",
|
||||
typeDescription = Just "description",
|
||||
superType = Nothing,
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" Nothing Nothing [], cardinality = Bounds(1, 1),
|
||||
superType = MakeType "Something" (BasicType "Object") Nothing [],
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" (BasicType "Object") Nothing [], cardinality = Bounds(1, 1),
|
||||
attributeDescription = Just "A time period multiplier, e.g. 1, 2 or 3 etc. A negative value can be used when specifying an offset relative to another date, e.g. -2 days."},
|
||||
MakeTypeAttribute {attributeName = "testMany", attributeType = MakeType "TestType" Nothing Nothing [], cardinality = OneBound 0,
|
||||
MakeTypeAttribute {attributeName = "testMany", attributeType = MakeType "TestType" (BasicType "Object") Nothing [], cardinality = OneBound 0,
|
||||
attributeDescription = Just "Test many"},
|
||||
MakeTypeAttribute {attributeName = "testSome", attributeType = MakeType "TestSomeType" Nothing Nothing [], cardinality = OneBound 1,
|
||||
MakeTypeAttribute {attributeName = "testSome", attributeType = MakeType "TestSomeType" (BasicType "Object") Nothing [], cardinality = OneBound 1,
|
||||
attributeDescription = Just "Test some"},
|
||||
MakeTypeAttribute {attributeName = "testMaybeOne", attributeType = MakeType "TestZeroOneType" Nothing Nothing [], cardinality = Bounds (0, 1),
|
||||
MakeTypeAttribute {attributeName = "testMaybeOne", attributeType = MakeType "TestZeroOneType" (BasicType "Object") Nothing [], cardinality = Bounds (0, 1),
|
||||
attributeDescription = Just "Test zero or one"},
|
||||
MakeTypeAttribute {attributeName = "testAll", attributeType = MakeType "Test" Nothing Nothing [], cardinality = Bounds (2, 15),
|
||||
MakeTypeAttribute {attributeName = "testAll", attributeType = MakeType "Test" (BasicType "Object") Nothing [], cardinality = Bounds (2, 15),
|
||||
attributeDescription = Just "Test all"}]},
|
||||
|
||||
MakeType {typeName = "TestType",
|
||||
typeDescription = Nothing,
|
||||
superType = Nothing,
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" Nothing Nothing [], cardinality = Bounds(1, 1),
|
||||
superType = BasicType "Object",
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" (BasicType "Object") Nothing [], cardinality = Bounds(1, 1),
|
||||
attributeDescription = Nothing}]},
|
||||
|
||||
|
||||
MakeType {typeName = "TestSomeType",
|
||||
typeDescription = Just "description",
|
||||
superType = Nothing,
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" Nothing Nothing [], cardinality = Bounds(1, 1),
|
||||
superType = BasicType "Object",
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" (BasicType "Object") Nothing [], cardinality = Bounds(1, 1),
|
||||
attributeDescription = Just "A time period multiplier, e.g. 1, 2 or 3 etc. A negative value can be used when specifying an offset relative to another date, e.g. -2 days."}]},
|
||||
|
||||
|
||||
MakeType {typeName = "TestZeroOneType",
|
||||
typeDescription = Nothing,
|
||||
superType = Just $ MakeType "Period" Nothing Nothing [],
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" Nothing Nothing [], cardinality = Bounds(1, 1),
|
||||
superType = MakeType "Period" (BasicType "Object") Nothing [],
|
||||
typeAttributes = [MakeTypeAttribute {attributeName = "periodMultiplier", attributeType = MakeType "int" (BasicType "Object") Nothing [], cardinality = Bounds(1, 1),
|
||||
attributeDescription = Nothing}]},
|
||||
|
||||
MakeType {typeName = "WrongCardinality", superType = Nothing, typeDescription = Just "description", typeAttributes = []},
|
||||
MakeType {typeName = "WrongCardinality", superType = BasicType "Object", typeDescription = Just "description", typeAttributes = []},
|
||||
|
||||
MakeType {typeName = "WrongCardinality2", superType = Nothing, typeDescription = Just "description", typeAttributes = []},
|
||||
MakeType {typeName = "WrongCardinality2", superType = BasicType "Object", typeDescription = Just "description", typeAttributes = []},
|
||||
|
||||
MakeType {typeName = "MissingType", superType = Nothing, typeDescription = Just "description", typeAttributes = []}
|
||||
MakeType {typeName = "MissingType", superType = BasicType "Object", typeDescription = Just "description", typeAttributes = []}
|
||||
|
||||
]
|
||||
Reference in New Issue
Block a user