AST transformations
Golang has a lot of features that are not currently supported by the go2pins
tool.
The goal of this internship is to handle more of these features.
The following steps will help you to setup your environnement:
-
install go compiler https://golang.org
-
install go2pins
(https://gitlab.lrde.epita.fr/spot/go2pins
), create your own branchhm/whatever
and build it -
install spot
(https://gitlab.lrde.epita.fr/spot/spot
) and build it with these steps
autoreconf -vfi
./configure
make
make check
-
The directory tests/ltsmin/
should now have a binary namedmodelcheck
. Use it (as described in the readme ofgo2pins
) to run theonly
test we have :(
Now that you have done that, you are ready to start your internship ! \o/
Next steps are then:
-
integrate the code in tools/print_ast
into the project, i.e. I want an option such thatgo2pins --print-ast
performs the same as the binary intools/print_ast
. This step will help you to discover the project and will be very useful for your AST processings. -
write a pass that trigger errors for the use of variable other than integer
. Have a look totransform/normalizedeclarations.go
which is the simplest pass we have. Create tests for checking that and integrate it. If you are familiar with Docker (or want to be) these tests will be ideally combined with spot and triggered every time a push is done -
Do the same for triggering errors when encontering: channels, panic, arrays (not supported for now, but easy to do maybe we handle that during your internship), struct, slices, pointers, interface, map, switch, and select. For each, use a dedicated pass and dedicated tests (I may missed something, but you can test all constructs in https://golang.org/ref/spec
). Use your--print-ast
option to ease your comprehension. -
Now, you should be able to understand very well the traversal and the structure of a go program. We can then focus to the support of recursion. First step is to build a callgraph. Then come to me so I can explain to you how we can manage the support of recursion :)