Wooo! Fixed up remaining bugs in new syntax!

This commit is contained in:
Nathan Braswell
2015-05-09 06:24:56 -04:00
parent acf751c016
commit 87e1853713
47 changed files with 277 additions and 284 deletions

View File

@@ -26,7 +26,7 @@ WS = actual_white | WS comment WS | WS comment | ;
# cpp_comment lets us do stuff like ending a statement with a cpp comment - c comments already work as they don't eat the return # cpp_comment lets us do stuff like ending a statement with a cpp comment - c comments already work as they don't eat the return
maybe_line_white = "( | )+" | ; maybe_line_white = "( | )+" | ;
line_end = maybe_line_white ";" | maybe_line_white line_break | maybe_line_white cpp_comment ; line_end = maybe_line_white ";" | maybe_line_white line_break | maybe_line_white cpp_comment | WS c_comment line_end ;
# line_end = "( | )+" ";" | "( | )+" line_break | "( | )+" cpp_comment | ";" | line_break | cpp_comment ; # line_end = "( | )+" ";" | "( | )+" line_break | "( | )+" cpp_comment | ";" | line_break | cpp_comment ;
# line_end = WS ";" | WS line_break | WS cpp_comment ; # line_end = WS ";" | WS line_break | WS cpp_comment ;

View File

@@ -580,7 +580,12 @@ NodeTree<ASTData>* ASTTransformation::transform(NodeTree<Symbol>* from, NodeTree
// NodeTree<ASTData>* newIdentifier = transform(children[1], scope); //Transform the identifier // NodeTree<ASTData>* newIdentifier = transform(children[1], scope); //Transform the identifier
// newIdentifier->getDataRef()->valueType = Type(concatSymbolTree(children[0]));//set the type of the identifier // newIdentifier->getDataRef()->valueType = Type(concatSymbolTree(children[0]));//set the type of the identifier
std::string newIdentifierStr = concatSymbolTree(children[0]); std::string newIdentifierStr = concatSymbolTree(children[0]);
Type* identifierType = typeFromTypeNode(children[2], scope, templateTypeReplacements); Type* identifierType;
if (children.size() > 1 && concatSymbolTree(children[1]) == ".")
identifierType = typeFromTypeNode(children.back(), scope, templateTypeReplacements);
else
identifierType = typeFromTypeNode(children[2], scope, templateTypeReplacements);
std::cout << "Declaring an identifier " << newIdentifierStr << " to be of type " << identifierType->toString() << std::endl; std::cout << "Declaring an identifier " << newIdentifierStr << " to be of type " << identifierType->toString() << std::endl;
NodeTree<ASTData>* newIdentifier = new NodeTree<ASTData>("identifier", ASTData(identifier, Symbol(newIdentifierStr, true), identifierType)); NodeTree<ASTData>* newIdentifier = new NodeTree<ASTData>("identifier", ASTData(identifier, Symbol(newIdentifierStr, true), identifierType));
addToScope(newIdentifierStr, newIdentifier, scope); addToScope(newIdentifierStr, newIdentifier, scope);
@@ -588,20 +593,20 @@ NodeTree<ASTData>* ASTTransformation::transform(NodeTree<Symbol>* from, NodeTree
addToScope("~enclosing_scope", newNode, newIdentifier); addToScope("~enclosing_scope", newNode, newIdentifier);
newNode->addChild(newIdentifier); newNode->addChild(newIdentifier);
if (children.size() > 2 && concatSymbolTree(children[2]) == ".") { if (children.size() > 1 && concatSymbolTree(children[1]) == ".") {
//A bit of a special case for declarations - if there's anything after just the normal 1 node declaration, it's either //A bit of a special case for declarations - if there's anything after just the normal 1 node declaration, it's either
//an expression that is assigned to the declaration (int a = 4;) or a member call (Object a.constructAThing()) //an expression that is assigned to the declaration (int a = 4;) or a member call (Object a.constructAThing())
//This code is a simplified version of the code in function_call with respect to access_operation. //This code is a simplified version of the code in function_call with respect to access_operation.
//Note that in this case, what is lhs there is our newIdentifier here (the declaration of the left side of the access operation) //Note that in this case, what is lhs there is our newIdentifier here (the declaration of the left side of the access operation)
auto sliced = slice(children, 4, -1); auto sliced = slice(children, 3, -3);
std::vector<NodeTree<ASTData>*> initPositionFuncParams = transformChildren(sliced, std::set<int>(), scope, types, templateTypeReplacements); std::vector<NodeTree<ASTData>*> initPositionFuncParams = transformChildren(sliced, std::set<int>(), scope, types, templateTypeReplacements);
NodeTree<ASTData>* rhs = transform(children[3], identifierType->typeDefinition, mapNodesToTypes(initPositionFuncParams), templateTypeReplacements); //If an access operation, then the right side will be in the lhs's type's scope NodeTree<ASTData>* rhs = transform(children[2], identifierType->typeDefinition, mapNodesToTypes(initPositionFuncParams), templateTypeReplacements); //If an access operation, then the right side will be in the lhs's type's scope
std::vector<NodeTree<ASTData>*> transformedChildren; transformedChildren.push_back(newIdentifier); transformedChildren.push_back(rhs); std::vector<NodeTree<ASTData>*> transformedChildren; transformedChildren.push_back(newIdentifier); transformedChildren.push_back(rhs);
NodeTree<ASTData>* accessFuncCall = doFunction(scope, ".", transformedChildren, templateTypeReplacements); NodeTree<ASTData>* accessFuncCall = doFunction(scope, ".", transformedChildren, templateTypeReplacements);
accessFuncCall->getDataRef()->valueType = rhs->getDataRef()->valueType; accessFuncCall->getDataRef()->valueType = rhs->getDataRef()->valueType;
//Now we borrow a bit of code from function_call below to actually use our new accessFuncCall to setup a "initPosition" function call //Now we borrow a bit of code from function_call below to actually use our new accessFuncCall to setup a "initPosition" function call
//that will follow the identifier in this declaration node //that will follow the identifier in this declaration node
std::string initPosFuncName = newIdentifierStr + "." + concatSymbolTree(children[3]); std::string initPosFuncName = newIdentifierStr + "." + concatSymbolTree(children[2]);
NodeTree<ASTData>* initPositionFuncCall = new NodeTree<ASTData>(initPosFuncName, ASTData(function_call, Symbol(initPosFuncName, true))); NodeTree<ASTData>* initPositionFuncCall = new NodeTree<ASTData>(initPosFuncName, ASTData(function_call, Symbol(initPosFuncName, true)));
initPositionFuncCall->addChild(accessFuncCall); initPositionFuncCall->addChild(accessFuncCall);
initPositionFuncCall->getDataRef()->valueType = accessFuncCall->getDataRef()->valueType; initPositionFuncCall->getDataRef()->valueType = accessFuncCall->getDataRef()->valueType;
@@ -998,7 +1003,7 @@ NodeTree<ASTData>* ASTTransformation::templateFunctionLookup(NodeTree<ASTData>*
if (!traitsEqual) if (!traitsEqual)
continue; continue;
std::vector<NodeTree<Symbol>*> functionParameters = slice(templateSyntaxTree->getChildren(), 2, -3, 2); //skip name, intervening commas, return type, and the code block std::vector<NodeTree<Symbol>*> functionParameters = slice(templateSyntaxTree->getChildren(), 2, -4, 2); //skip name, intervening commas, return type, and the code block
std::cout << functionParameters.size() << " " << types.size() << std::endl; std::cout << functionParameters.size() << " " << types.size() << std::endl;
if (functionParameters.size() != types.size()) if (functionParameters.size() != types.size())
continue; continue;

View File

@@ -4,11 +4,11 @@ __if_comp__ __C__ simple_passthrough """
#include <stdio.h> #include <stdio.h>
""" """
|void| println() { fun println() : void {
print("\n"); print("\n");
} }
|void| print(|char*| toPrint) { fun print(toPrint: char*) : void {
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(toPrint = toPrint::) """ simple_passthrough(toPrint = toPrint::) """
printf(toPrint); printf(toPrint);
@@ -17,20 +17,20 @@ __if_comp__ __C__ simple_passthrough """
return; return;
} }
|void| println(|char*| toPrint) { fun println(toPrint: char*) : void {
print(toPrint); print(toPrint);
println(); println();
} }
|void| print(|string| toPrint) { fun print(toPrint: string) : void {
print(toPrint.toCharArray()); print(toPrint.toCharArray());
} }
|void| println(|string| toPrint) { fun println(toPrint: string): void {
println(toPrint.toCharArray()); println(toPrint.toCharArray());
} }
|void| print(|int| toPrint) { fun print(toPrint: int): void {
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(toPrint = toPrint::) """ simple_passthrough(toPrint = toPrint::) """
printf("%d", toPrint); printf("%d", toPrint);
@@ -39,12 +39,12 @@ __if_comp__ __C__ simple_passthrough """
return; return;
} }
|void| println(|int| toPrint) { fun println(toPrint: int): void {
print(toPrint); print(toPrint);
println(); println();
} }
|void| print(|float| toPrint) { fun print(toPrint: float): void {
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(toPrint = toPrint::) """ simple_passthrough(toPrint = toPrint::) """
printf("%f", toPrint); printf("%f", toPrint);
@@ -53,7 +53,7 @@ __if_comp__ __C__ simple_passthrough """
return; return;
} }
|void| print(|double| toPrint) { fun print(toPrint: double) : void{
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(toPrint = toPrint::) """ simple_passthrough(toPrint = toPrint::) """
printf("%f", toPrint); printf("%f", toPrint);
@@ -62,20 +62,15 @@ __if_comp__ __C__ simple_passthrough """
return; return;
} }
|void| println(|float| toPrint) { fun println(toPrint: float): void {
print(toPrint); print(toPrint);
println(); println();
} }
|void| println(|double| toPrint){ fun println(toPrint: double): void {
print(toPrint); print(toPrint);
println(); println();
} }

View File

@@ -2,7 +2,7 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
#include <math.h> #include <math.h>
""" """
|int| fibanacci(|int| num) { fun fibanacci(num: int): int {
if (num < 2) if (num < 2)
return 1; return 1;
return fibanacci(num-1) + fibanacci(num-2); return fibanacci(num-1) + fibanacci(num-2);
@@ -12,9 +12,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
* Trig Functions * Trig Functions
********************/ ********************/
|double| atan(|double| arg) fun atan(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = atan(arg); ans = atan(arg);
@@ -24,9 +24,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end atan function }//end atan function
|double| atan2(|double| x, |double| y) fun atan2(x: double, y: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(x = x, y = y, ans = ans : ans = ans :) """ simple_passthrough(x = x, y = y, ans = ans : ans = ans :) """
ans = atan2(x,y); ans = atan2(x,y);
@@ -36,9 +36,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end atan2 function }//end atan2 function
|double| acos(|double| arg) fun acos(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = acos(arg); ans = acos(arg);
@@ -48,9 +48,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end acos function }//end acos function
|double| asin(|double| arg) fun asin(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = asin(arg); ans = asin(arg);
@@ -60,9 +60,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end asin function }//end asin function
|double| tan(|double| arg) fun tan(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = tan(arg); ans = tan(arg);
@@ -72,9 +72,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end tan function }//end tan function
|double| cos(|double| arg) fun cos(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = cos(arg); ans = cos(arg);
@@ -84,9 +84,9 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
return ans; return ans;
}//end cos function }//end cos function
|double| sin(|double| arg) fun sin(arg: double): double
{ {
|double| ans = 0; var ans: double = 0;
__if_comp__ __C__{ __if_comp__ __C__{
simple_passthrough(arg = arg, ans = ans : ans = ans :) """ simple_passthrough(arg = arg, ans = ans : ans = ans :) """
ans = sin(arg); ans = sin(arg);
@@ -99,11 +99,3 @@ __if_comp__ __C__ simple_passthrough(::"-lm") """
//|int| NotPi = 3; //|int| NotPi = 3;
//|double| STD_PI = 4*atan(1); //|double| STD_PI = 4*atan(1);

View File

@@ -4,8 +4,8 @@ __if_comp__ __C__ simple_passthrough """
/* we have a template versions so we don't have to cast (because we don't have that yet) */ /* we have a template versions so we don't have to cast (because we don't have that yet) */
template <T> |T*| malloc(|int| size) { fun malloc<T>(size: int): T* {
|T*| memPtr; var memPtr: T*;
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough( size = size, memPtr = memPtr : memPtr = memPtr :) """ simple_passthrough( size = size, memPtr = memPtr : memPtr = memPtr :) """
memPtr = malloc(size); memPtr = malloc(size);
@@ -14,7 +14,7 @@ template <T> |T*| malloc(|int| size) {
return memPtr; return memPtr;
} }
template <T> |void| free(|T*| memPtr) { fun free<T>(memPtr: T*): void {
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(memPtr = memPtr ::) """ simple_passthrough(memPtr = memPtr ::) """
free(memPtr); free(memPtr);
@@ -22,9 +22,9 @@ template <T> |void| free(|T*| memPtr) {
} }
} }
template <T> |int| sizeof() { fun sizeof<T>(): int {
|T| testObj; var testObj: T;
|int| result; var result: int;
__if_comp__ __C__ { __if_comp__ __C__ {
simple_passthrough(testObj = testObj : result = result:) """ simple_passthrough(testObj = testObj : result = result:) """
int result = sizeof(testObj); int result = sizeof(testObj);
@@ -33,32 +33,32 @@ template <T> |int| sizeof() {
return result; return result;
} }
template <T> |T*| new(|int| count) { fun new<T>(count: int): T* {
return malloc<T>( sizeof<T>() * count ); return malloc<T>( sizeof<T>() * count );
} }
template <T> |T*| new() { fun new<T>(): T* {
return new<T>(1); return new<T>(1);
} }
/* We specilize on the trait Destructable to decide on whether or not the destructor should be called */ /* We specilize on the trait Destructable to decide on whether or not the destructor should be called */
template <T> |void| delete(|T*| toDelete, |int| itemCount) { fun delete<T>(toDelete: T*, itemCount: int): void {
delete<T>(toDelete); delete<T>(toDelete);
} }
/* Calling this with itemCount = 0 allows you to delete destructable objects without calling their destructors. */ /* Calling this with itemCount = 0 allows you to delete destructable objects without calling their destructors. */
template <T(Destructable)> |void| delete(|T*| toDelete, |int| itemCount) { fun delete<T(Destructable)>(toDelete: T*, itemCount: int): void {
for (|int| i = 0; i < itemCount; i++;) for (var i: int = 0; i < itemCount; i++;)
toDelete[i].destruct(); toDelete[i].destruct();
delete<T>(toDelete); delete<T>(toDelete);
} }
/* We specilize on the trait Destructable to decide on whether or not the destructor should be called */ /* We specilize on the trait Destructable to decide on whether or not the destructor should be called */
template <T> |void| delete(|T*| toDelete) { fun delete<T>(toDelete: T*): void {
free<T>(toDelete); free<T>(toDelete);
} }
template <T(Destructable)> |void| delete(|T*| toDelete) { fun delete<T(Destructable)>(toDelete: T*): void {
toDelete->destruct(); toDelete->destruct();
free<T>(toDelete); free<T>(toDelete);
} }

View File

@@ -2,12 +2,12 @@ import vector;
import mem; import mem;
typedef string (Destructable) { typedef string (Destructable) {
|vector::vector<char>| data; var data: vector::vector<char>;
|string*| construct() { fun construct(): string* {
data.construct(); data.construct();
return this; return this;
} }
|string*| construct(|char*| str) { fun construct(str: char*): string* {
data.construct(); data.construct();
while(*str) { while(*str) {
data.addEnd(*str); data.addEnd(*str);
@@ -16,9 +16,9 @@ typedef string (Destructable) {
return this; return this;
} }
|char*| toCharArray() { fun toCharArray(): char* {
|char*| out = mem::new<char>(data.size); var out: char* = mem::new<char>(data.size);
for (|int| i = 0; i < data.size; i++;) for (var i: int = 0; i < data.size; i++;)
out[i] = data.get(i); out[i] = data.get(i);
return out; return out;
} }

View File

@@ -1,8 +1,8 @@
import io; import io;
typedef template <T> trivialContainer { typedef trivialContainer<T> {
|T| data; var data: T;
|void| print() { fun print(): void {
io::print(data); io::print(data);
} }
}; };

View File

@@ -1,11 +1,11 @@
template<T> |T| greater(|T| a, |T| b) { fun greater<T>(a: T, b: T): T {
if (a > b) if (a > b)
return a; return a;
return b; return b;
} }
template<T> |T| lesser(|T| a, |T| b) { fun lesser<T>(a: T, b: T): T {
if (a > b) if (a > b)
return b; return b;
return a; return a;

View File

@@ -2,27 +2,27 @@ import mem:*;
import util:*; import util:*;
import io:*; import io:*;
typedef template<T> vector (Destructable) { typedef vector<T> (Destructable) {
|T*| data; var data: T*;
|int| size; var size: int;
|int| available; var available: int;
|vector<T>*| construct() { fun construct(): vector<T>* {
size = 0; size = 0;
available = 8; available = 8;
data = new<T>(8); data = new<T>(8);
return this; return this;
} }
|void| destruct() { fun destruct(): void {
delete<T>(data); delete<T>(data);
} }
|bool| resize(|int| newSize) { fun resize(newSize: int): bool {
|T*| newData = new<T>(newSize); var newData: T* = new<T>(newSize);
if (!newData) if (!newData)
return false; return false;
for (|int| i = 0; i < lesser<int>(size, newSize); i++;) for (var i: int = 0; i < lesser<int>(size, newSize); i++;)
newData[i] = data[i]; newData[i] = data[i];
delete<T>(data, 0); delete<T>(data, 0);
data = newData; data = newData;
@@ -30,11 +30,11 @@ typedef template<T> vector (Destructable) {
return true; return true;
} }
|T| at(|int| index) { fun at(index: int): T {
return get(index); return get(index);
} }
|T| get(|int| index) { fun get(index: int): T {
if (index < 0 || index >= size) { if (index < 0 || index >= size) {
println("Vector access out of bounds! Retuning 0th element as sanest option"); println("Vector access out of bounds! Retuning 0th element as sanest option");
print("Vector tried to access element: "); print("Vector tried to access element: ");
@@ -44,17 +44,18 @@ typedef template<T> vector (Destructable) {
return data[index]; return data[index];
} }
|T*| getBackingMemory() { return data; } fun getBackingMemory(): T* { return data; }
|void| set(|int| index, |T| dataIn) { fun set(index: int, dataIn: T): void {
if (index < 0 || index >= size) if (index < 0 || index >= size)
return; return;
data[index] = dataIn; data[index] = dataIn;
} }
|void| addEnd(|T| dataIn) { fun addEnd(dataIn: T): void {
size++; size++;
if (size >= available) if (size >= available)
resize(size*2); resize(size*2);
data[size-1] = dataIn; data[size-1] = dataIn;
} }
}; };

View File

@@ -4,13 +4,13 @@ __if_comp__ __C__ simple_passthrough """
int diff = 7; int diff = 7;
""" """
|void| print_it() { fun print_it(): void {
__if_comp__ __C__ simple_passthrough """ __if_comp__ __C__ simple_passthrough """
printf("diff_file: %d\n", diff); printf("diff_file: %d\n", diff);
""" """
} }
|void| print_it(|int| i) { fun print_it(i: int): void {
__if_comp__ __C__ simple_passthrough(i = i::) """ __if_comp__ __C__ simple_passthrough(i = i::) """
printf("diff_file: %d\n", i); printf("diff_file: %d\n", i);
""" """

View File

@@ -1,7 +1,7 @@
|int| sameVar; var sameVar: int;
|int| sameFun() { return 5; } fun sameFun(): int { return 5; }
typedef classTester { typedef classTester {
|int| method() { return 8; } fun method(): int { return 8; }
} }

View File

@@ -1,6 +1,6 @@
|int| sameVar; var sameVar: int;
|int| sameFun() { return 6; } fun sameFun(): int { return 6; }
typedef classTester { typedef classTester {
|int| method() { return 9; } fun method(): int { return 9; }
} }

View File

@@ -1,27 +1,27 @@
|int| qualified_variable = 7; var qualified_variable: int = 7;
|int| qualified_func() { return 9; } fun qualified_func(): int { return 9; }
typedef qualified_class { typedef qualified_class {
|int| number; var number: int;
|qualified_class*| construct(|int| num) { fun construct(num: int): qualified_class* {
number = num; number = num;
return this; return this;
} }
|int| get() { fun get(): int {
return number; return number;
} }
}; };
typedef template <T> qualified_container { typedef qualified_container<T> {
|T| data; var data: T;
|qualified_container<T>*| construct(|T| dataIn) { fun construct(dataIn: T): qualified_container<T>* {
data = dataIn; data = dataIn;
} }
|T| get() { fun get(): T {
return data; return data;
} }
}; };
template<T> |T| qualified_id(|T| it) { fun qualified_id<T>(it: T): T {
return it; return it;
} }

View File

@@ -1,27 +1,27 @@
|int| unqualifed_variable = 8; var unqualifed_variable: int = 8;
|int| unqualified_func() { return 10; } fun unqualified_func(): int { return 10; }
typedef unqualified_class { typedef unqualified_class {
|int| number; var number: int;
|unqualified_class*| construct(|int| num) { fun construct(num: int): unqualified_class* {
number = num; number = num;
return this; return this;
} }
|int| get() { fun get(): int {
return number; return number;
} }
}; };
typedef template <T> unqualified_container { typedef unqualified_container<T> {
|T| data; var data: T;
|unqualified_container<T>*| construct(|T| dataIn) { fun construct(dataIn: T): unqualified_container<T>* {
data = dataIn; data = dataIn;
} }
|T| get() { fun get(): T {
return data; return data;
} }
}; };
template<T> |T| unqualified_id(|T| it) { fun unqualified_id<T>(it: T): T {
return it; return it;
} }

View File

@@ -1,44 +1,44 @@
import io:*; import io:*;
typedef Vec2 { typedef Vec2 {
|int| x; var x: int;
|int| y; var y: int;
|void| print() { fun print(): void {
print(x); print(x);
print(" "); print(" ");
print(y); print(y);
} }
|Vec2| add(|Vec2| other) { fun add(other: Vec2): Vec2 {
|Vec2| toReturn; var toReturn: Vec2;
toReturn.x = x + other.x; toReturn.x = x + other.x;
toReturn.y = y + other.y; toReturn.y = y + other.y;
print(); print();
return toReturn; return toReturn;
} }
|Vec2| subtract(|Vec2| other) { fun subtract(other: Vec2): Vec2 {
|Vec2| toReturn; var toReturn: Vec2;
toReturn.x = x - other.x; toReturn.x = x - other.x;
toReturn.y = y - other.y; toReturn.y = y - other.y;
print(); print();
return toReturn; return toReturn;
} }
|Vec2| operator+(|Vec2| other) { fun operator+(other: Vec2): Vec2 {
return add(other); return add(other);
} }
}; };
|Vec2| operator-(|Vec2| lhs, |Vec2| rhs) { fun operator-(lhs: Vec2, rhs: Vec2): Vec2 {
return lhs.subtract(rhs); return lhs.subtract(rhs);
} }
|int| main() { fun main(): int {
|Vec2| vector1; var vector1: Vec2;
|Vec2| vector2; var vector2: Vec2;
vector1.x = 3; vector1.x = 3;
vector1.y = 9; vector1.y = 9;
vector2 = vector1; vector2 = vector1;
@@ -48,13 +48,13 @@ typedef Vec2 {
vector3.y = vector1.y + vector2.y; vector3.y = vector1.y + vector2.y;
vector2.print(); vector2.print();
*/ */
|Vec2| addition = vector1 + vector2; var addition: Vec2 = vector1 + vector2;
print("\n"); print("\n");
addition.print(); addition.print();
print("\nSubtraction\n"); print("\nSubtraction\n");
vector2.x = 100; vector2.x = 100;
vector2.y = 70; vector2.y = 70;
|Vec2| subtraction = vector1 - vector2; var subtraction: Vec2 = vector1 - vector2;
print("\n"); print("\n");
print(subtraction.x); print(" "); print(subtraction.y); print(subtraction.x); print(" "); print(subtraction.y);

View File

@@ -1,12 +1,12 @@
import io:*; import io:*;
|int| fibanacci(|int| num) { fun fibanacci(num: int): int {
if (num < 2) if (num < 2)
return 1; return 1;
return fibanacci(num-1) + fibanacci(num-2); return fibanacci(num-1) + fibanacci(num-2);
} }
|int| main() { fun main(): int {
print(fibanacci(4)); print(fibanacci(4));
print("\n"); print("\n");
return 0; return 0;

View File

@@ -1,18 +1,18 @@
import io; import io;
|int| main() { fun main(): void {
io::println("Spam"); io::println("Spam");
|int| x = 4; var x: int = 4;
x += 3; x += 3;
x++; x++;
|int| y = 6; var y :int = 6;
|int| z = x + y; var z :int = x + y;
|int| q = z+z; var q :int = z+z;
|int| q2 = z*3; var q2:int = z*3;
|int| q3 = y + y; var q3:int = y + y;
io::println(q3); io::println(q3);
io::println(z); io::println(z);
io::println(q); io::println(q);
for (|int| i = 0; i < 20; i++;) z++; for (var i:int = 0; i < 20; i++;) z++;
if (z > 20) io::println("We'll find out."); if (z > 20) io::println("We'll find out.");
io::println(z); io::println(z);
} }

View File

@@ -6,15 +6,15 @@ __if_comp__ __C__ simple_passthrough """
int same = 5; int same = 5;
""" """
|int| main() { fun main(): int {
__if_comp__ __C__ simple_passthrough """ __if_comp__ __C__ simple_passthrough """
printf("same_file: %d\n", same); printf("same_file: %d\n", same);
""" """
c_passthrough_diff::print_it(); c_passthrough_diff::print_it();
|int| i = 7; var i: int = 7;
|int| j = 6; var j: int = 6;
__if_comp__ __C__ simple_passthrough(i = i, j = j : j = j:) """ __if_comp__ __C__ simple_passthrough(i = i, j = j : j = j:) """
j = i + j; j = i + j;
""" """

View File

@@ -1,12 +1,12 @@
import vector:*; import vector:*;
import io:*; import io:*;
template <T> |T| test(|vector<T>| a) { fun test<T>(a: vector<T>): T {
return a.at(0); return a.at(0);
} }
|int| main() { fun main(): int {
|vector<int>| a.construct(); var a.construct(): vector<int>;
a.addEnd(2); a.addEnd(2);
println(test<int>(a)); println(test<int>(a));
return 0; return 0;

View File

@@ -1,7 +1,7 @@
/* Comment first! */ /* Comment first! */
import io:*; import io:*;
|int| main() { fun main(): int {
println(1337) /*how bout now*/ println(1337) /*how bout now*/
println(42) //or now println(42) //or now
return 0; return 0;

View File

@@ -2,24 +2,24 @@ import io:*;
import mem:*; import mem:*;
typedef ClassWithConstructor { typedef ClassWithConstructor {
|int| data; var data: int;
|ClassWithConstructor*| construct(|int| inData) { fun construct(inData: int): ClassWithConstructor* {
data = inData; data = inData;
return this; return this;
} }
|void| printData() { fun printData(): void {
println(data); println(data);
} }
}; };
|int| main() { fun main(): int {
|ClassWithConstructor| object.construct(4); var object.construct(4): ClassWithConstructor;
//ClassWithConstructor object; //ClassWithConstructor object;
//object.construct(4); //object.construct(4);
object.printData(); object.printData();
|int| a = 8; var a: int = 8;
println(a); println(a);
|ClassWithConstructor*| objPtr = new<ClassWithConstructor>()->construct(11); var objPtr: ClassWithConstructor* = new<ClassWithConstructor>()->construct(11);
objPtr->printData(); objPtr->printData();
delete<ClassWithConstructor>(objPtr); delete<ClassWithConstructor>(objPtr);
return 0; return 0;

View File

@@ -1,27 +1,27 @@
import io:*; import io:*;
typedef DestructorPrint { typedef DestructorPrint {
|char*| myStr; var myStr: char*;
|DestructorPrint*| construct(|char*| str) { fun construct(str: char*): DestructorPrint* {
myStr = str; myStr = str;
return this; return this;
} }
|void| destruct() { fun destruct(): void {
println(myStr); println(myStr);
} }
}; };
typedef NoDistruction { typedef NoDistruction {
|int| a; var a: int;
|void| dummyFunc() {} fun dummyFunc(): void {}
}; };
|void| indirPrint() { fun indirPrint(): void {
|DestructorPrint| testObj.construct("Hello Destructors!"); var testObj.construct("Hello Destructors!"): DestructorPrint;
|NoDistruction| dummy; var dummy: NoDistruction;
} }
|int| main() { fun main(): int {
indirPrint(); indirPrint();
return 0; return 0;
} }

View File

@@ -1,7 +1,7 @@
import io:*; import io:*;
|int| main() { fun main(): int {
if (1>2) { if (1>2) {
println("Wrong"); println("Wrong");
} else { } else {

View File

@@ -1,8 +1,8 @@
import io; import io;
|void| nothing() {} fun nothing(): void {}
|int| main() { fun main(): int {
nothing(); nothing();
io::println("It was nothing"); io::println("It was nothing");
return 0; return 0;

View File

@@ -1,10 +1,10 @@
import io:*; import io:*;
template <T,J> |void| addAndPrint(|T| a, |J| b) { fun addAndPrint<T,J>(a: T, b: J): void {
print(a+b); print(a+b);
} }
|int| main() { fun main(): int {
addAndPrint<int,double>(10,12.14159); addAndPrint<int,double>(10,12.14159);
print("\n"); print("\n");

View File

@@ -1,17 +1,17 @@
import io:*; import io:*;
|int| ret1() { fun ret1(): int {
return ret2() / 2; return ret2() / 2;
} }
|int| main() { fun main(): int {
print(ret1()); print(ret1());
print(ret2()); print(ret2());
print("\n"); print("\n");
return 0; return 0;
} }
|int| ret2() { fun ret2(): int {
return 2; return 2;
} }

View File

@@ -1,11 +1,11 @@
import io; import io;
template <T> |T| addAndPrint(|T| a, |T| b) { fun addAndPrint<T>(a: T, b: T): T {
io::print(a+b); io::print(a+b);
return a+b; return a+b;
} }
|int| main() { fun main(): int {
addAndPrint<int>(10,12); addAndPrint<int>(10,12);
io::print("\n"); io::print("\n");

View File

@@ -2,11 +2,11 @@ import mem:*;
import io:*; import io:*;
typedef AnObject { typedef AnObject {
|int| a; var a: int;
|int| b; var b: int;
|char*| c; var c: char*;
|void| print() { fun print(): void {
print(a+b); print(a+b);
print("\n"); print("\n");
print(c); print(c);
@@ -15,8 +15,8 @@ typedef AnObject {
}; };
|int| main() { fun main(): int {
|AnObject*| ptr = new<AnObject>(); var ptr: AnObject* = new<AnObject>();
ptr->a = 4; ptr->a = 4;
ptr->b = 7; ptr->b = 7;
ptr->c = "Hello decent memory! Quite a nice feeling\n"; ptr->c = "Hello decent memory! Quite a nice feeling\n";

View File

@@ -1,25 +1,25 @@
import io:*; import io:*;
typedef firstObject { typedef firstObject {
|int| objectNum; var objectNum: int;
|int| other; var other: int;
|void| print() { fun print(): void {
print(other); print(other);
} }
|void| printInd() { fun printInd(): void {
print(); print();
} }
}; };
typedef Int int; typedef Int int;
|Int| aliasNum; var aliasNum: Int;
|int| main() { fun main(): int {
|firstObject| wooObject; var wooObject: firstObject;
wooObject.objectNum = 7; wooObject.objectNum = 7;
print(wooObject.objectNum); print(wooObject.objectNum);
|firstObject*| objPtr = &wooObject; var objPtr: firstObject* = &wooObject;
objPtr->objectNum = 42; objPtr->objectNum = 42;
print(objPtr->objectNum); print(objPtr->objectNum);
print("\n"); print("\n");

View File

@@ -2,30 +2,30 @@ import io:*;
import trivial_container:*; import trivial_container:*;
typedef RegularObject { typedef RegularObject {
|int| num; var num: int;
|trivialContainer<char*>| innerContainer; var innerContainer: trivialContainer<char*>;
|void| set(|char*| message, |int| number) { fun set(message: char*, number: int): void {
innerContainer.data = message; innerContainer.data = message;
num = number; num = number;
} }
|char*| get() { fun get(): char* {
return innerContainer.data; return innerContainer.data;
} }
|void| print() { fun print(): void {
print(num); print(num);
innerContainer.print(); innerContainer.print();
} }
}; };
typedef MyIntContainer trivialContainer<int>; typedef MyIntContainer trivialContainer<int>;
|MyIntContainer| roundabout; var roundabout: MyIntContainer;
|RegularObject| outsideDec; var outsideDec: RegularObject;
|void| print(|trivialContainer<char*>| toPrint) { fun print(toPrint: trivialContainer<char*>): void {
print(toPrint.data); print(toPrint.data);
} }
|int| main() { fun main(): int {
roundabout.data = 4; roundabout.data = 4;
outsideDec.set("Hello!", 5); outsideDec.set("Hello!", 5);
roundabout.print(); roundabout.print();

View File

@@ -1,7 +1,7 @@
import io:*; import io:*;
|int| main() { fun main(): int {
if (1 != 2) if (1 != 2)
println("Correct"); println("Correct");
} }

View File

@@ -2,16 +2,16 @@ import io;
import scopeQualified; import scopeQualified;
import scopeUnqualified : * ; import scopeUnqualified : * ;
|int| main() { fun main(): int {
io::println("Qualified io!"); io::println("Qualified io!");
// Defined in scopeQualified // Defined in scopeQualified
io::println(scopeQualified::qualified_variable); io::println(scopeQualified::qualified_variable);
io::println(scopeQualified::qualified_func()); io::println(scopeQualified::qualified_func());
|scopeQualified::qualified_class| qClass.construct(11); var qClass.construct(11): scopeQualified::qualified_class;
io::println(qClass.get()); io::println(qClass.get());
|scopeQualified::qualified_container<char*>| sayQualified.construct("Qualified Container!"); var sayQualified.construct("Qualified Container!"): scopeQualified::qualified_container<char*>;
io::println(sayQualified.get()); io::println(sayQualified.get());
io::println(scopeQualified::qualified_id<char*>("Even template functions qualified!")); io::println(scopeQualified::qualified_id<char*>("Even template functions qualified!"));
@@ -21,10 +21,10 @@ import scopeUnqualified : * ;
// Defined in scopeUnqualified // Defined in scopeUnqualified
io::println(unqualifed_variable); io::println(unqualifed_variable);
io::println(unqualified_func()); io::println(unqualified_func());
|unqualified_class| uqClass.construct(12); var uqClass.construct(12): unqualified_class;
io::println(uqClass.get()); io::println(uqClass.get());
|unqualified_container<char*>| sayUnqualified.construct("Unqualified Container!"); var sayUnqualified.construct("Unqualified Container!"): unqualified_container<char*>;
io::println(sayUnqualified.get()); io::println(sayUnqualified.get());
io::println(unqualified_id<char*>("Even template functions unqualified!")); io::println(unqualified_id<char*>("Even template functions unqualified!"));

View File

@@ -1,6 +1,6 @@
import io:* import io:*
|int| main() { fun main(): int {
println("no semicolons!") println("no semicolons!")
if (1 < 2) println("still no!") if (1 < 2) println("still no!")
println("and again") println("and again")

View File

@@ -1,24 +1,24 @@
import io:*; import io:*;
typedef objectA { typedef objectA {
|int| a; var a: int;
}; };
typedef BigObject { typedef BigObject {
|objectA| a; var a: objectA;
|objectB| b; var b: objectB;
|int| add() { fun add(): int {
return a.a + b.b; return a.a + b.b;
} }
}; };
typedef objectB { typedef objectB {
|int| b; var b: int;
}; };
|int| main() { fun main(): int {
|BigObject| c; var c: BigObject;
c.a.a = 4; c.a.a = 4;
c.b.b = 8; c.b.b = 8;
print(c.add()); print(c.add());

View File

@@ -2,23 +2,23 @@ import io:*
import sameNameOne import sameNameOne
import sameNameTwo import sameNameTwo
|int| sameVar; var sameVar: int;
|int| sameFun() { return 4; } fun sameFun(): int { return 4; }
typedef classTester { typedef classTester {
|int| method() { fun method(): int {
return 7 return 7
} }
} }
|int| main() { fun main(): int {
sameVar = 1 sameVar = 1
sameNameOne::sameVar = 2 sameNameOne::sameVar = 2
sameNameTwo::sameVar = 3 sameNameTwo::sameVar = 3
|classTester| class1; var class1: classTester;
|sameNameOne::classTester| class2; var class2: sameNameOne::classTester;
|sameNameTwo::classTester| class3; var class3: sameNameTwo::classTester;
println(sameVar) println(sameVar)
println(sameNameOne::sameVar) println(sameNameOne::sameVar)

View File

@@ -1,11 +1,11 @@
import io:*; import io:*;
|int| addAndPrintInt(|int| a, |int| b) { fun addAndPrintInt(a: int, b: int): int {
print(a+b); print(a+b);
return a+b; return a+b;
} }
|int| main() { fun main(): int {
print(addAndPrintInt(7,12)); print(addAndPrintInt(7,12));
print("\n"); print("\n");

View File

@@ -1,10 +1,10 @@
import io; import io;
typedef template <T,J> TemplateTest { typedef TemplateTest<T,J> {
|T| a; var a: T;
|J| b; var b: J;
|void| print() { fun print(): void {
io::print("a: "); io::print("a: ");
io::print(a); io::print(a);
io::print("\n"); io::print("\n");
@@ -14,10 +14,10 @@ typedef template <T,J> TemplateTest {
} }
}; };
|int| main() { fun main(): int {
|TemplateTest<int, char*>| test; var test: TemplateTest<int, char*>;
|TemplateTest<char*, char*>| test2; var test2: TemplateTest<char*, char*>;
test.a = 24; test.a = 24;
test.b = "Hello World"; test.b = "Hello World";
test2.a = "Pi incoming"; test2.a = "Pi incoming";

View File

@@ -1,10 +1,10 @@
import io; import io;
typedef template <T> TemplateTest { typedef TemplateTest<T> {
|int| a; var a: int;
|T| b; var b: T;
|void| print() { fun print(): void {
io::print("a: "); io::print("a: ");
io::print(a); io::print(a);
io::print("\n"); io::print("\n");
@@ -14,10 +14,10 @@ typedef template <T> TemplateTest {
} }
}; };
|int| main() { fun main(): int {
|TemplateTest<int>| test; var test: TemplateTest<int>;
|TemplateTest<char*>| test2; var test2: TemplateTest<char*>;
test.a = 5; test.a = 5;
test.b = 7; test.b = 7;
test2.a = 9; test2.a = 9;

View File

@@ -1,15 +1,15 @@
import io; import io;
typedef FirstObject { typedef FirstObject {
|int| objectNum; var objectNum: int;
|void| PrintSelf(|int| a) { fun PrintSelf(a: int): void {
io::print(objectNum); io::print(objectNum);
io::print(a); io::print(a);
} }
}; };
|int| main() { fun main(): int {
|FirstObject| wooObject; var wooObject: FirstObject;
wooObject.objectNum = 5; wooObject.objectNum = 5;
wooObject.PrintSelf(7); wooObject.PrintSelf(7);
io::print("\n"); io::print("\n");

View File

@@ -2,8 +2,8 @@ import io;
import string; import string;
|int| main() { fun main(): int {
|string::string| str.construct("hello strings"); var str.construct("hello strings"): string::string;
io::println(str); io::println(str);
return 0; return 0;
} }

View File

@@ -1,11 +1,11 @@
import io:*; import io:*;
import trivial_container:*; import trivial_container:*;
typedef template <T> TemplateTest { typedef TemplateTest<T> {
|int| a; var a: int;
|T| b; var b: T;
|trivialContainer<T>| c; var c: trivialContainer<T>;
|void| print() { fun print(): void {
print("a: "); print("a: ");
print(a); print(a);
print("\n"); print("\n");
@@ -19,17 +19,17 @@ typedef template <T> TemplateTest {
typedef MyInt int; typedef MyInt int;
|MyInt| c; var c: MyInt;
template <T> |T| addAndPrint(|T| a, |T| b) { fun addAndPrint<T>(a: T, b: T): T {
print(a+b); print(a+b);
return a+b; return a+b;
} }
|int| main() { fun main(): int {
|TemplateTest<int>| test; var test: TemplateTest<int>;
|TemplateTest<char*>| test2; var test2: TemplateTest<char*>;
test.a = 5; test.a = 5;
test.b = 7; test.b = 7;
test.c.data = 1337; test.c.data = 1337;
@@ -40,7 +40,7 @@ template <T> |T| addAndPrint(|T| a, |T| b) {
test.print(); test.print();
test2.print(); test2.print();
|trivialContainer<char*>| testImport; var testImport: trivialContainer<char*>;
testImport.data = "From another file! Whoh!"; testImport.data = "From another file! Whoh!";
testImport.print(); testImport.print();
print("\n"); print("\n");

View File

@@ -1,9 +1,9 @@
import io:*; import io:*;
import mem:*; import mem:*;
|int| main() { fun main(): int {
|int| b; var b: int;
|int*| a = &b; var a: int* = &b;
a [ 0 ] = 7; a [ 0 ] = 7;
print(a [ 0 ] ); print(a [ 0 ] );
print(*a); print(*a);

View File

@@ -1,8 +1,8 @@
import io; import io;
|int| a = 42; var a: int = 42;
|int| main() { fun main(): int {
io::println(a); io::println(a);
return 0; return 0;
} }

View File

@@ -7,19 +7,19 @@ typedef Trait2 (SecondTrait) {};
typedef TwoTrait (FirstTrait, SecondTrait) {}; typedef TwoTrait (FirstTrait, SecondTrait) {};
typedef AlreadySpecilized (FirstTrait, SecondTrait) {}; typedef AlreadySpecilized (FirstTrait, SecondTrait) {};
template <T> |void| OneTwoFunc(|T| obj) { fun OneTwoFunc<T>(obj: T): void {
println("No Traits"); println("No Traits");
} }
template <T(FirstTrait)> |void| OneTwoFunc(|T| obj) { fun OneTwoFunc<T(FirstTrait)>(obj: T): void {
println("First Trait"); println("First Trait");
} }
template <T(SecondTrait)> |void| OneTwoFunc(|T| obj) { fun OneTwoFunc<T(SecondTrait)>(obj: T): void {
println("Second Trait"); println("Second Trait");
} }
template <T(FirstTrait, SecondTrait)> |void| OneTwoFunc(|T| obj) { fun OneTwoFunc<T(FirstTrait, SecondTrait)>(obj: T): void {
println("Both Traits"); println("Both Traits");
} }
/* /*
@@ -30,10 +30,10 @@ template <AlreadySpecilized> |void| OneTwoFunc(|AlreadySpecilized| obj) {
//This should work for objects too! //This should work for objects too!
//To test, we cycle the mapping of traits //To test, we cycle the mapping of traits
typedef template<T> OneTwoObj (FirstTrait) {}; typedef OneTwoObj<T> (FirstTrait) {};
typedef template<T(FirstTrait)> OneTwoObj (SecondTrait) {}; typedef OneTwoObj<T(FirstTrait)> (SecondTrait) {};
typedef template<T(SecondTrait)> OneTwoObj (FirstTrait, SecondTrait) {}; typedef OneTwoObj<T(SecondTrait)> (FirstTrait, SecondTrait) {};
typedef template<T(FirstTrait, SecondTrait)> OneTwoObj {}; typedef OneTwoObj<T(FirstTrait, SecondTrait)> {};
/* /*
*typedef template<AlreadySpecilized> OneTwoObj { *typedef template<AlreadySpecilized> OneTwoObj {
* void proveSpecilized() { * void proveSpecilized() {
@@ -42,12 +42,12 @@ typedef template<T(FirstTrait, SecondTrait)> OneTwoObj {};
*}; *};
*/ */
|int| main() { fun main(): int {
|NoTraits| a; var a: NoTraits;
|Trait1| b; var b: Trait1;
|Trait2| c; var c: Trait2;
|TwoTrait| d; var d: TwoTrait;
|AlreadySpecilized| e; var e: AlreadySpecilized;
OneTwoFunc<NoTraits>(a); OneTwoFunc<NoTraits>(a);
OneTwoFunc<Trait1>(b); OneTwoFunc<Trait1>(b);
@@ -57,10 +57,10 @@ typedef template<T(FirstTrait, SecondTrait)> OneTwoObj {};
println(); println();
|OneTwoObj<NoTraits>| alpha; var alpha: OneTwoObj<NoTraits>;
|OneTwoObj<Trait1>| beta; var beta: OneTwoObj<Trait1>;
|OneTwoObj<Trait2>| gamma; var gamma: OneTwoObj<Trait2>;
|OneTwoObj<TwoTrait>| delta; var delta: OneTwoObj<TwoTrait>;
// |OneTwoObj<AlreadySpecilized>| epsilon; // |OneTwoObj<AlreadySpecilized>| epsilon;
OneTwoFunc<OneTwoObj<NoTraits>>(alpha); OneTwoFunc<OneTwoObj<NoTraits>>(alpha);

View File

@@ -1,10 +1,10 @@
import io:*; import io:*;
import math:*; import math:*;
|int| main() fun main(): int
{ {
|double| ans; var ans: double;
|double| STD_PI = 4.0*atan(1.0); var STD_PI: double = 4.0*atan(1.0);
println(STD_PI); println(STD_PI);
/* /*

View File

@@ -1,20 +1,20 @@
import io; import io;
typedef ClassWithConstructor { typedef ClassWithConstructor {
|int| data; var data: int;
|ClassWithConstructor*| construct(|int| inData) { fun construct(inData: int): ClassWithConstructor* {
data = inData; data = inData;
return this; return this;
} }
|void| printData() { fun printData(): void {
io::println(data); io::println(data);
} }
}; };
|int| main() { fun main(): int {
|ClassWithConstructor| object.construct(4); var object.construct(4): ClassWithConstructor;
object.printData(); object.printData();
|int| a = 8; var a :int = 8;
io::println(a); io::println(a);
return 0; return 0;
} }

View File

@@ -3,25 +3,25 @@ import mem:*;
import vector:*; import vector:*;
typedef AbleToBeDestroyed (Destructable) { typedef AbleToBeDestroyed (Destructable) {
|void| destruct() { fun destruct(): void {
println("Destroyed!"); println("Destroyed!");
} }
}; };
|int| main() { fun main(): int {
|vector<int>| intVec.construct(); var intVec.construct(): vector<int>;
intVec.addEnd(1); intVec.addEnd(1);
intVec.addEnd(3); intVec.addEnd(3);
intVec.addEnd(3); intVec.addEnd(3);
intVec.addEnd(7); intVec.addEnd(7);
println(intVec.size); println(intVec.size);
for (|int| i = 0; i < intVec.size; i++;) for (var i: int = 0; i < intVec.size; i++;)
print(intVec.at(i)); print(intVec.at(i));
println(); println();
|vector<AbleToBeDestroyed>*| desVec = new<vector<AbleToBeDestroyed>>()->construct(); var desVec: vector<AbleToBeDestroyed>* = new<vector<AbleToBeDestroyed>>()->construct();
|AbleToBeDestroyed| testDestruct; var testDestruct: AbleToBeDestroyed;
desVec->addEnd(testDestruct); desVec->addEnd(testDestruct);
delete<vector<AbleToBeDestroyed>>(desVec); delete<vector<AbleToBeDestroyed>>(desVec);