return 1;\r
}\r
\r
- std::string s = tree->toStringTree(&parser) + "\n";\r
-\r
+ //std::string s = tree->toStringTree(&parser) + "\n";\r
//std::cout << "Parse Tree: " << s << std::endl;\r
\r
Program prg = getProgram(prog, nullptr);\r
{\r
tocProgram(std::cout, prg);\r
\r
- // if (!checkProgram(prg))\r
- // std::cerr << "Error" << std::endl;\r
-\r
std::ofstream ofs("output.c");\r
tocProgram(ofs, prg);\r
ofs.close();\r
struct Function\r
{\r
std::string name;\r
- std::vector<std::string> genericTypeNames;\r
- std::vector<std::vector<Type>> genericInstantiations;\r
Type returnType;\r
std::vector<Variable> parameters;\r
bool defined;\r
+\r
+ std::vector<std::string> genericTypeNames;\r
+ std::vector<std::vector<Type>> genericInstantiations;\r
+\r
Body body;\r
};\r
\r
}\r
}\r
\r
+struct S2 {\r
+ abc(): S2 { }\r
+ xyz(): S2 { }\r
+}\r
+\r
func generic1<A>(a1 : A, a2 : A) : A {\r
return a1 + a2;\r
}\r
generic1<int>(1, 2);\r
generic1<double>(3.4, 5.6);\r
\r
+ var s: S2;\r
+ s.abc().xyz();\r
+\r
return 0;\r
}
\ No newline at end of file
\r
\r
\r
-\r
+~14.08 Abgabe Paper/Code\r
\r
\r
Missing:\r
-- unions\r
+- unions/enums\r
- const/static/extern\r
-- operator precedence\r
+- operator precedence(given by C compiler)\r
- bitfields\r
- nested bodies {}\r
- multiple files\r
- call outer functions with same name (::f1())\r
+- automatically select function/var/struct from namespace recursively\r
- generic methods\r
- nested type instantiation\r
- automatic dereference/->\r