Projects/Visitormania

From D Wiki
Revision as of 09:57, 12 December 2017 by RazvanN (talk | contribs) (Created page with "====Visitormania==== Currently, the compiler visitor is a dummy visitor which implements visiting methods that do nothing. Every time the AST is traversed to do specific acti...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Visitormania

Currently, the compiler visitor is a dummy visitor which implements visiting methods that do nothing. Every time the AST is traversed to do specific actions for specific nodes a lot of code needs to be written to express the traversal logic and actions taken. While the actions differ depending on what needs to be done, the AST traversal is mostly the same.

This project aims at (1) redesigning the current implementation of the compiler visitor and (2) developing new visitors tailored to specific needs in order to facilitate the an easier way to use the visitors in the compiler and in the future compiler library.

Among the visitors that will be implemented are:


1.ParseTimeVisitor/SemanticTimeVisitor which are the base of the rest of the visitors. These visitors implement `assert(0)` visiting methods for all abstract AST nodes.

2. PermissiveParseTimeVisitor/PermissiveSemanticTimeVisitor which implement empty visiting methods for all AST nodes. These visitors are useful where only a subtree of the AST needs exploring

3. TransitiveParseTimeVisitor/TransitiveSemanticTimeVisitor which implement the AST traversal logic forr all AST nodes. These visitors eliminate all boilerplate code of traversing the AST nodes.