Port many tests and fix small bugs revealed in Kalypso (passes 24/72) - tests have also revealed more extensive features not yet implemented, and I seem to have messed up a test or two so that the C++ version also fails a couple more (it's at 59/71 now). Will investigate
This commit is contained in:
@@ -144,8 +144,8 @@ alpha_alphanumeric = "(a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C
|
|||||||
augmented_alpha_alphanumeric = alpha_alphanumeric augmented_alpha_alphanumeric | keywords_also_identifiers augmented_alpha_alphanumeric | alpha_alphanumeric | keywords_also_identifiers ;
|
augmented_alpha_alphanumeric = alpha_alphanumeric augmented_alpha_alphanumeric | keywords_also_identifiers augmented_alpha_alphanumeric | alpha_alphanumeric | keywords_also_identifiers ;
|
||||||
|
|
||||||
numeric = "(0|1|2|3|4|5|6|7|8|9)+" ;
|
numeric = "(0|1|2|3|4|5|6|7|8|9)+" ;
|
||||||
# note the hacks around \things
|
# note the hacks around \things. Hmm, I feel like it actually shouldn't be like this. Added \\\* because I want to come back later
|
||||||
string = triple_quoted_string | "\"(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i|o|p|[|]|(\\\\)|(\\n)|(\\t)|(\\0)|a|s|d|f|g|h|j|k|l|;|'|
|
string = triple_quoted_string | "\"(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i|o|p|[|]|(\\\\)|(\\n)|(\\t)|(\\\*)|(\\0)|a|s|d|f|g|h|j|k|l|;|'|
|
||||||
|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|Z|X|C|V|B|N|M|<|>|\?| |(\\\"))*\"" ;
|
|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|Z|X|C|V|B|N|M|<|>|\?| |(\\\"))*\"" ;
|
||||||
comment = cpp_comment | c_comment ;
|
comment = cpp_comment | c_comment ;
|
||||||
cpp_comment = "//(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i|o|p|[|]|\\|a|s|d|f|g|h|j|k|l|;|'|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|\"|Z|X|C|V|B|N|M|<|>|\?| )*
|
cpp_comment = "//(`|1|2|3|4|5|6|7|8|9|0|-|=| |q|w|e|r|t|y|u|i|o|p|[|]|\\|a|s|d|f|g|h|j|k|l|;|'|z|x|c|v|b|n|m|,|.|/|~|!|@|#|$|%|^|&|\*|\(|\)|_|\+|Q|W|E|R|T|Y|U|I|O|P|{|}|\||A|S|D|F|G|H|J|K|L|:|\"|Z|X|C|V|B|N|M|<|>|\?| )*
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ fun transform_value(node: *tree<symbol>, scope: *ast_node): *ast_node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contains_dot)
|
if (contains_dot)
|
||||||
|
if (value_str[value_str.length()-1] == 'f')
|
||||||
|
value_type = type_ptr(base_type::floating()) //value_type = type_ptr(base_type::floating())
|
||||||
|
else
|
||||||
value_type = type_ptr(base_type::double_precision()) //value_type = type_ptr(base_type::floating())
|
value_type = type_ptr(base_type::double_precision()) //value_type = type_ptr(base_type::floating())
|
||||||
else
|
else
|
||||||
value_type = type_ptr(base_type::integer())
|
value_type = type_ptr(base_type::integer())
|
||||||
@@ -418,7 +421,10 @@ fun transform_for_loop(node: *tree<symbol>, scope: *ast_node, template_replaceme
|
|||||||
return for_loop
|
return for_loop
|
||||||
}
|
}
|
||||||
fun transform_return_statement(node: *tree<symbol>, scope: *ast_node, template_replacements: map<string, *type>): *ast_node {
|
fun transform_return_statement(node: *tree<symbol>, scope: *ast_node, template_replacements: map<string, *type>): *ast_node {
|
||||||
return ast_return_statement_ptr(transform(node->children[0], scope, template_replacements))
|
var return_value = get_node("boolean_expression", node)
|
||||||
|
if (return_value)
|
||||||
|
return ast_return_statement_ptr(transform(return_value, scope, template_replacements))
|
||||||
|
return ast_return_statement_ptr(null<ast_node>())
|
||||||
}
|
}
|
||||||
fun transform_branching_statement(node: *tree<symbol>, scope: *ast_node): *ast_node {
|
fun transform_branching_statement(node: *tree<symbol>, scope: *ast_node): *ast_node {
|
||||||
if (node->data.name == "break_statement")
|
if (node->data.name == "break_statement")
|
||||||
@@ -485,11 +491,13 @@ fun transform_expression(node: *tree<symbol>, scope: *ast_node, searching_for: s
|
|||||||
return ast_function_call_ptr(get_builtin_function(func_name, parameter_types), parameters)
|
return ast_function_call_ptr(get_builtin_function(func_name, parameter_types), parameters)
|
||||||
}
|
}
|
||||||
fun get_builtin_function(name: string, param_types: vector<*type>): *ast_node {
|
fun get_builtin_function(name: string, param_types: vector<*type>): *ast_node {
|
||||||
if (name == "." || name == "->")
|
if (name == "==" || name == "!=" || name == ">" || name == "<" || name == "<=" || name == ">" || name == ">=" || name == "&&" || name == "||" || name == "!")
|
||||||
|
return ast_function_ptr(name, type_ptr(param_types, type_ptr(base_type::boolean())), vector<*ast_node>())
|
||||||
|
if (name == "." || name == "->" || name == "[")
|
||||||
return ast_function_ptr(name, type_ptr(param_types, param_types[1]), vector<*ast_node>())
|
return ast_function_ptr(name, type_ptr(param_types, param_types[1]), vector<*ast_node>())
|
||||||
if (name == "&")
|
if (name == "&")
|
||||||
return ast_function_ptr(name, type_ptr(param_types, param_types[0]->clone_with_increased_indirection()), vector<*ast_node>())
|
return ast_function_ptr(name, type_ptr(param_types, param_types[0]->clone_with_increased_indirection()), vector<*ast_node>())
|
||||||
if (name == "\\*")
|
if (name == "\*")
|
||||||
return ast_function_ptr(name, type_ptr(param_types, param_types[0]->clone_with_decreased_indirection()), vector<*ast_node>())
|
return ast_function_ptr(name, type_ptr(param_types, param_types[0]->clone_with_decreased_indirection()), vector<*ast_node>())
|
||||||
if (param_types.size > 1 && param_types[1]->rank() > param_types[0]->rank())
|
if (param_types.size > 1 && param_types[1]->rank() > param_types[0]->rank())
|
||||||
return ast_function_ptr(name, type_ptr(param_types, param_types[1]), vector<*ast_node>())
|
return ast_function_ptr(name, type_ptr(param_types, param_types[1]), vector<*ast_node>())
|
||||||
|
|||||||
@@ -164,6 +164,11 @@ obj c_generator (Object) {
|
|||||||
}
|
}
|
||||||
ast_node::type_def(backing) {
|
ast_node::type_def(backing) {
|
||||||
type_poset.add_vertex(child)
|
type_poset.add_vertex(child)
|
||||||
|
backing.variables.for_each(fun(i: *ast_node) {
|
||||||
|
var var_type = get_ast_type(i->declaration_statement.identifier)
|
||||||
|
if (!var_type->indirection && var_type->type_def)
|
||||||
|
type_poset.add_relationship(child, var_type->type_def)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -244,6 +249,8 @@ obj c_generator (Object) {
|
|||||||
}
|
}
|
||||||
fun generate_return_statement(node: *ast_node, enclosing_object: *ast_node, defer_stack: *stack<pair<bool,stack<*ast_node>>>): code_triple {
|
fun generate_return_statement(node: *ast_node, enclosing_object: *ast_node, defer_stack: *stack<pair<bool,stack<*ast_node>>>): code_triple {
|
||||||
var return_value = node->return_statement.return_value
|
var return_value = node->return_statement.return_value
|
||||||
|
if (!return_value)
|
||||||
|
return code_triple("return")
|
||||||
var return_value_type = get_ast_type(return_value)
|
var return_value_type = get_ast_type(return_value)
|
||||||
var to_ret = code_triple()
|
var to_ret = code_triple()
|
||||||
// if we're returning an object, copy_construct a new one to return
|
// if we're returning an object, copy_construct a new one to return
|
||||||
@@ -333,12 +340,14 @@ obj c_generator (Object) {
|
|||||||
var parameters = node->function_call.parameters
|
var parameters = node->function_call.parameters
|
||||||
if ( parameters.size == 2 && (func_name == "+" || func_name == "-" || func_name == "*" || func_name == "/" || func_name == "||"
|
if ( parameters.size == 2 && (func_name == "+" || func_name == "-" || func_name == "*" || func_name == "/" || func_name == "||"
|
||||||
|| func_name == "&&" || func_name == "<" || func_name == ">" || func_name == "<=" || func_name == ">="
|
|| func_name == "&&" || func_name == "<" || func_name == ">" || func_name == "<=" || func_name == ">="
|
||||||
|| func_name == "==" || func_name == "%"
|
|| func_name == "==" || func_name == "!=" || func_name == "%"
|
||||||
))
|
))
|
||||||
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + func_name + generate(parameters[1], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + string(")")
|
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + func_name + generate(parameters[1], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + string(")")
|
||||||
// don't propegate enclosing function down right of access
|
// don't propegate enclosing function down right of access
|
||||||
if (func_name == "." || func_name == "->")
|
if (func_name == "." || func_name == "->")
|
||||||
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + func_name + generate(parameters[1], null<ast_node>(), null<stack<pair<bool,stack<*ast_node>>>>()) + string(")")
|
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + func_name + generate(parameters[1], null<ast_node>(), null<stack<pair<bool,stack<*ast_node>>>>()) + string(")")
|
||||||
|
if (func_name == "[")
|
||||||
|
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + "[" + generate(parameters[1], null<ast_node>(), null<stack<pair<bool,stack<*ast_node>>>>()) + string("])")
|
||||||
// the post ones need to be post-ed specifically, and take the p off
|
// the post ones need to be post-ed specifically, and take the p off
|
||||||
if (func_name == "++p" || func_name == "--p")
|
if (func_name == "++p" || func_name == "--p")
|
||||||
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + ")" + func_name.slice(0,-2)
|
return code_triple("(") + generate(parameters[0], enclosing_object, null<stack<pair<bool,stack<*ast_node>>>>()) + ")" + func_name.slice(0,-2)
|
||||||
|
|||||||
@@ -50,10 +50,12 @@ obj importer (Object) {
|
|||||||
println("**Fourth Pass**")
|
println("**Fourth Pass**")
|
||||||
name_ast_map.for_each(fun(name: string, tree_pair: pair<*tree<symbol>, *ast_node>) ast_pass.fourth_pass(tree_pair.first, tree_pair.second);)
|
name_ast_map.for_each(fun(name: string, tree_pair: pair<*tree<symbol>, *ast_node>) ast_pass.fourth_pass(tree_pair.first, tree_pair.second);)
|
||||||
|
|
||||||
|
/*
|
||||||
name_ast_map.for_each(fun(name: string, tree_pair: pair<*tree<symbol>, *ast_node>) {
|
name_ast_map.for_each(fun(name: string, tree_pair: pair<*tree<symbol>, *ast_node>) {
|
||||||
print("writing ast for: "); println(name)
|
print("writing ast for: "); println(name)
|
||||||
write_file(name + ".ast.dot", ast_to_dot(tree_pair.second))
|
write_file(name + ".ast.dot", ast_to_dot(tree_pair.second))
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
return to_ret
|
return to_ret
|
||||||
}
|
}
|
||||||
@@ -74,11 +76,11 @@ obj importer (Object) {
|
|||||||
})
|
})
|
||||||
var parse_tree = parse.parse_input(file, file_name)
|
var parse_tree = parse.parse_input(file, file_name)
|
||||||
print("post-parse: "); println(file_name)
|
print("post-parse: "); println(file_name)
|
||||||
write_file(file_name + ".parse.dot", syntax_tree_to_dot(parse_tree))
|
/*write_file(file_name + ".parse.dot", syntax_tree_to_dot(parse_tree))*/
|
||||||
print("pre-trim: "); println(file_name)
|
print("pre-trim: "); println(file_name)
|
||||||
trim(parse_tree)
|
trim(parse_tree)
|
||||||
print("post-trim: "); println(file_name)
|
print("post-trim: "); println(file_name)
|
||||||
write_file(file_name + ".trimmed_parse.dot", syntax_tree_to_dot(parse_tree))
|
/*write_file(file_name + ".trimmed_parse.dot", syntax_tree_to_dot(parse_tree))*/
|
||||||
print("pre-first-ast: "); println(file_name)
|
print("pre-first-ast: "); println(file_name)
|
||||||
var ast = ast_pass.first_pass(file_name, parse_tree, this)
|
var ast = ast_pass.first_pass(file_name, parse_tree, this)
|
||||||
print("post-first-ast: "); println(file_name)
|
print("post-first-ast: "); println(file_name)
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ fun println(to_print: double) {
|
|||||||
print(to_print)
|
print(to_print)
|
||||||
print("\n")
|
print("\n")
|
||||||
}
|
}
|
||||||
|
fun println(to_print: bool) {
|
||||||
|
print(to_print)
|
||||||
|
print("\n")
|
||||||
|
}
|
||||||
fun print(to_print: *char) {
|
fun print(to_print: *char) {
|
||||||
__if_comp__ __C__ simple_passthrough(to_print::) """
|
__if_comp__ __C__ simple_passthrough(to_print::) """
|
||||||
printf("%s", to_print);
|
printf("%s", to_print);
|
||||||
@@ -48,4 +52,8 @@ fun print(to_print: double) {
|
|||||||
printf("%f", to_print);
|
printf("%f", to_print);
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
fun print(to_print: bool) {
|
||||||
|
if (to_print) print("true")
|
||||||
|
else print("false")
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
fun fibanacci(num: int): int {
|
fun fibanacci(num: int): int {
|
||||||
if (num < 2)
|
if (num < 2)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun retVoid() {
|
fun retVoid() {
|
||||||
println("Woooo")
|
println("Woooo")
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ Spam
|
|||||||
We'll find out.
|
We'll find out.
|
||||||
34
|
34
|
||||||
woo not
|
woo not
|
||||||
true
|
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
import string:*
|
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
io::println("Spam");
|
simple_print::println("Spam");
|
||||||
var x: int = 4;
|
var x: int = 4;
|
||||||
x += 3;
|
x += 3;
|
||||||
x++;
|
x++;
|
||||||
@@ -11,15 +10,14 @@ fun main(): int {
|
|||||||
var q :int = z+z;
|
var q :int = z+z;
|
||||||
var q2:int = z*3;
|
var q2:int = z*3;
|
||||||
var q3:int = y + y;
|
var q3:int = y + y;
|
||||||
io::println(q3);
|
simple_print::println(q3);
|
||||||
io::println(z);
|
simple_print::println(z);
|
||||||
io::println(q);
|
simple_print::println(q);
|
||||||
for (var i:int = 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) simple_print::println("We'll find out.");
|
||||||
io::println(z);
|
simple_print::println(z);
|
||||||
var boolean = false
|
var boolean = false
|
||||||
if ( z > 20 && !boolean)
|
if ( z > 20 && !boolean)
|
||||||
io::println("woo not")
|
simple_print::println("woo not")
|
||||||
io::println(string("ab")[0] == 'a')
|
simple_print::println('b' == 'a')
|
||||||
io::println('b' == 'a')
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj BracketAssign {
|
obj BracketAssign {
|
||||||
fun operator[]=(index:int, rhs:int) {
|
fun operator[]=(index:int, rhs:int) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun main():int {
|
fun main():int {
|
||||||
for (var i = 1; i < 10; i++;) {
|
for (var i = 1; i < 10; i++;) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*here*/
|
/*here*/
|
||||||
/*here*/import /*here*/io/*here*/:/*here*/*/*here*/
|
/*here*/import /*here*/simple_print/*here*/:/*here*/*/*here*/
|
||||||
/*here*/
|
/*here*/
|
||||||
/*here*/fun/*here*/ main/*here*/(/*here*/)/*here*/:/*here*/ int/*here*/ {/*here*/
|
/*here*/fun/*here*/ main/*here*/(/*here*/)/*here*/:/*here*/ int/*here*/ {/*here*/
|
||||||
/*here*/ println/*here*/( /*here*/1 /*here*/ )/*here*/
|
/*here*/ println/*here*/( /*here*/1 /*here*/ )/*here*/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
import vector:*
|
import vector:*
|
||||||
|
|
||||||
fun onlyMatch(vec: vector<int>, matchWith: int): vector<int> {
|
fun onlyMatch(vec: vector<int>, matchWith: int): vector<int> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import vector:*;
|
import vector:*;
|
||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
fun test<T>(a: vector<T>): T {
|
fun test<T>(a: vector<T>): T {
|
||||||
return a.at(0);
|
return a.at(0);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Comment first! */
|
/* Comment first! */
|
||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
println(1337) /*how bout now*/
|
println(1337) /*how bout now*/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj wDestructor {
|
obj wDestructor {
|
||||||
var data: *char
|
var data: *char
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
fun ret1(): int {
|
fun ret1(): int {
|
||||||
return ret2() / 2;
|
return ret2() / 2;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj Traited(Traits) {}
|
obj Traited(Traits) {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun do_num(it: int) {
|
fun do_num(it: int) {
|
||||||
print("int: ")
|
print("int: ")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
obj firstObject {
|
obj firstObject {
|
||||||
var objectNum: int;
|
var objectNum: int;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun main():int {
|
fun main():int {
|
||||||
println("multi
|
println("multi
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
import io;
|
import simple_print;
|
||||||
import scopeQualified;
|
import scopeQualified;
|
||||||
import scopeUnqualified : * ;
|
import scopeUnqualified : * ;
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
io::println("Qualified io!");
|
simple_print::println("Qualified simple_print!");
|
||||||
|
|
||||||
// Defined in scopeQualified
|
// Defined in scopeQualified
|
||||||
io::println(scopeQualified::qualified_variable);
|
simple_print::println(scopeQualified::qualified_variable);
|
||||||
io::println(scopeQualified::qualified_func());
|
simple_print::println(scopeQualified::qualified_func());
|
||||||
var qClass.construct(11): scopeQualified::qualified_class;
|
var qClass.construct(11): scopeQualified::qualified_class;
|
||||||
io::println(qClass.get());
|
simple_print::println(qClass.get());
|
||||||
|
|
||||||
var sayQualified.construct("Qualified Container!"): scopeQualified::qualified_container<*char>;
|
var sayQualified.construct("Qualified Container!"): scopeQualified::qualified_container<*char>;
|
||||||
io::println(sayQualified.get());
|
simple_print::println(sayQualified.get());
|
||||||
io::println(scopeQualified::qualified_id<*char>("Even template functions qualified!"));
|
simple_print::println(scopeQualified::qualified_id<*char>("Even template functsimple_printns qualified!"));
|
||||||
|
|
||||||
io::println();
|
simple_print::println();
|
||||||
|
|
||||||
io::println("Unqualified io!");
|
simple_print::println("Unqualified simple_print!");
|
||||||
// Defined in scopeUnqualified
|
// Defined in scopeUnqualified
|
||||||
io::println(unqualifed_variable);
|
simple_print::println(unqualifed_variable);
|
||||||
io::println(unqualified_func());
|
simple_print::println(unqualified_func());
|
||||||
var uqClass.construct(12): unqualified_class;
|
var uqClass.construct(12): unqualified_class;
|
||||||
io::println(uqClass.get());
|
simple_print::println(uqClass.get());
|
||||||
|
|
||||||
var sayUnqualified.construct("Unqualified Container!"): unqualified_container<*char>;
|
var sayUnqualified.construct("Unqualified Container!"): unqualified_container<*char>;
|
||||||
io::println(sayUnqualified.get());
|
simple_print::println(sayUnqualified.get());
|
||||||
io::println(unqualified_id<*char>("Even template functions unqualified!"));
|
simple_print::println(unqualified_id<*char>("Even template functsimple_printns unqualified!"));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
println("no semicolons!")
|
println("no semicolons!")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
|
|
||||||
obj objectA {
|
obj objectA {
|
||||||
var a: int;
|
var a: int;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun oneLine1():void println(7)
|
fun oneLine1():void println(7)
|
||||||
fun oneLine2():int return 8
|
fun oneLine2():int return 8
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj test_cons(Object) {
|
obj test_cons(Object) {
|
||||||
fun construct(): *test_cons {
|
fun construct(): *test_cons {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
import sameNameOne
|
import sameNameOne
|
||||||
import sameNameTwo
|
import sameNameTwo
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
fun is_true():bool {
|
fun is_true():bool {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io;
|
import simple_print;
|
||||||
|
|
||||||
|
|
||||||
obj TemplateTest<T,J> {
|
obj TemplateTest<T,J> {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import io;
|
import simple_print;
|
||||||
|
|
||||||
obj FirstObject {
|
obj FirstObject {
|
||||||
var objectNum: int;
|
var objectNum: int;
|
||||||
fun PrintSelf(a: int): void {
|
fun PrintSelf(a: int): void {
|
||||||
io::print(objectNum);
|
simple_print::print(objectNum);
|
||||||
io::print(a);
|
simple_print::print(a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -12,6 +12,6 @@ fun main(): int {
|
|||||||
var wooObject: FirstObject;
|
var wooObject: FirstObject;
|
||||||
wooObject.objectNum = 5;
|
wooObject.objectNum = 5;
|
||||||
wooObject.PrintSelf(7);
|
wooObject.PrintSelf(7);
|
||||||
io::print("\n");
|
simple_print::print("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj templd<T> {
|
obj templd<T> {
|
||||||
var data: T
|
var data: T
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
import trivial_container:*;
|
import trivial_container:*;
|
||||||
|
|
||||||
obj TemplateTest<T> {
|
obj TemplateTest<T> {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
import mem:*;
|
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
var b: int;
|
var b: int;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import io;
|
import simple_print;
|
||||||
|
|
||||||
var a: int = 42;
|
var a: int = 42;
|
||||||
var b = "hi";
|
var b = "hi";
|
||||||
|
|
||||||
fun main(): int {
|
fun main(): int {
|
||||||
io::println(a);
|
simple_print::println(a);
|
||||||
io::println(b);
|
simple_print::println(b);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io:*;
|
import simple_print:*;
|
||||||
import math:*;
|
import math:*;
|
||||||
|
|
||||||
fun main(): int
|
fun main(): int
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import io;
|
import simple_print;
|
||||||
|
|
||||||
obj ClassWithConstructor {
|
obj ClassWithConstructor {
|
||||||
var data: int;
|
var data: int;
|
||||||
@@ -7,7 +7,7 @@ obj ClassWithConstructor {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
fun printData(): void {
|
fun printData(): void {
|
||||||
io::println(data);
|
simple_print::println(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -15,6 +15,6 @@ fun main(): int {
|
|||||||
var object.construct(4): ClassWithConstructor;
|
var object.construct(4): ClassWithConstructor;
|
||||||
object.printData();
|
object.printData();
|
||||||
var a :int = 8;
|
var a :int = 8;
|
||||||
io::println(a);
|
simple_print::println(a);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import util:*
|
import util:*
|
||||||
import io:*
|
import simple_print:*
|
||||||
|
|
||||||
obj test(Object) {
|
obj test(Object) {
|
||||||
var counter:int
|
var counter:int
|
||||||
|
|||||||
Reference in New Issue
Block a user