From: Patrick Schönberger Date: Wed, 11 Aug 2021 15:18:26 +0000 (+0200) Subject: example and todo X-Git-Url: https://gitweb.ps.run/toc/commitdiff_plain/3715a3f575b615f66e8ea7e57f83849e8bae4deb example and todo --- diff --git a/src/main.cpp b/src/main.cpp index e7c03e6..3523cdf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,8 +31,7 @@ int main(int argc, const char * argv[]) return 1; } - std::string s = tree->toStringTree(&parser) + "\n"; - + //std::string s = tree->toStringTree(&parser) + "\n"; //std::cout << "Parse Tree: " << s << std::endl; Program prg = getProgram(prog, nullptr); @@ -41,9 +40,6 @@ int main(int argc, const char * argv[]) { tocProgram(std::cout, prg); - // if (!checkProgram(prg)) - // std::cerr << "Error" << std::endl; - std::ofstream ofs("output.c"); tocProgram(ofs, prg); ofs.close(); diff --git a/src/repr.h b/src/repr.h index b30aecd..ff54f97 100644 --- a/src/repr.h +++ b/src/repr.h @@ -79,11 +79,13 @@ struct Body struct Function { std::string name; - std::vector genericTypeNames; - std::vector> genericInstantiations; Type returnType; std::vector parameters; bool defined; + + std::vector genericTypeNames; + std::vector> genericInstantiations; + Body body; }; diff --git a/test/test2.toc b/test/test2.toc index 6e8d4f8..1447c8f 100644 --- a/test/test2.toc +++ b/test/test2.toc @@ -35,6 +35,11 @@ struct S1 { } } +struct S2 { + abc(): S2 { } + xyz(): S2 { } +} + func generic1(a1 : A, a2 : A) : A { return a1 + a2; } @@ -57,5 +62,8 @@ func main(argc : int, argv : char**) : int { generic1(1, 2); generic1(3.4, 5.6); + var s: S2; + s.abc().xyz(); + return 0; } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 25b4473..e066ece 100644 --- a/todo.txt +++ b/todo.txt @@ -44,17 +44,18 @@ define grammar: - +~14.08 Abgabe Paper/Code Missing: -- unions +- unions/enums - const/static/extern -- operator precedence +- operator precedence(given by C compiler) - bitfields - nested bodies {} - multiple files - call outer functions with same name (::f1()) +- automatically select function/var/struct from namespace recursively - generic methods - nested type instantiation - automatic dereference/->