Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Wiki
  • Tutorials
  • adding a traversal

adding a traversal · Changes

Page history
Improve doc string in adding-a-traversal.md larger template and write types in... authored Feb 28, 2025 by Quinten Cabo's avatar Quinten Cabo
Improve doc string in adding-a-traversal.md larger template and write types in the format that we use in Coding-Style.md. Remove the doxygen in the template because it doesn't seem to be used by new traversals.
Hide whitespace changes
Inline Side-by-side
tutorials/adding-a-traversal.md
View page @ 7be864b9
...@@ -119,7 +119,10 @@ Replace `cmake-build-debug` with the directory where you keep the build version ...@@ -119,7 +119,10 @@ Replace `cmake-build-debug` with the directory where you keep the build version
Copy this template traversal header code into the file you created in step 2. Copy this template traversal header code into the file you created in step 2.
```c ```c
/** <!-**********************************************************--> #ifndef _SAC_TRAVTEMPLATE_H_
#define _SAC_TRAVTEMPLATE_H_
/*******************************************************************
* author: <Your name> * author: <Your name>
* created-at: dd-mm-yyyy * created-at: dd-mm-yyyy
* description: * description:
...@@ -128,9 +131,7 @@ Copy this template traversal header code into the file you created in step 2. ...@@ -128,9 +131,7 @@ Copy this template traversal header code into the file you created in step 2.
* Prefix: TEMP * Prefix: TEMP
* *
*********************************************************************/ *********************************************************************/
#ifndef _SAC_TRAVTEMPLATE_H_
#define _SAC_TRAVTEMPLATE_H_
#include "types.h" #include "types.h"
extern node *TEMPdoTemplateTraversal (node *syntax_tree); extern node *TEMPdoTemplateTraversal (node *syntax_tree);
...@@ -207,14 +208,17 @@ struct INFO { ...@@ -207,14 +208,17 @@ struct INFO {
node *fundef; // some random info node *fundef; // some random info
}; };
node *EXdoExampleTraversal (node *syntax_tree) { node *
EXdoExampleTraversal (node *syntax_tree) {
return syntax_tree; return syntax_tree;
} }
node *EXmodule (node *arg_node, info *arg_info) { node *
EXmodule (node *arg_node, info *arg_info) {
return arg_node; return arg_node;
} }
node *EXfundef (node *arg_node, info *arg_info) { node *
EXfundef (node *arg_node, info *arg_info) {
return arg_node; return arg_node;
} }
``` ```
...@@ -238,12 +242,8 @@ There is also a template for your traversal `.c` file, here it is: ...@@ -238,12 +242,8 @@ There is also a template for your traversal `.c` file, here it is:
* *
* @brief short description * @brief short description
* *
* description: * Longer traversal description goes here with examples.
* Longer traversal description goes here with examples.
* *
* example:
*
* @{
**********************************************************/ **********************************************************/
#include "template_traversal.h" // update to your .h file #include "template_traversal.h" // update to your .h file
...@@ -367,8 +367,6 @@ DummyStaticHelper (node *arg_node) ...@@ -367,8 +367,6 @@ DummyStaticHelper (node *arg_node)
DBUG_RETURN (arg_node); DBUG_RETURN (arg_node);
} }
/* @} */
``` ```
Copy this template into your `.c` file. Copy this template into your `.c` file.
......
Clone repository
  • concepts
    • Deprecated Modules
    • Globals
    • Named Tuples
    • Overloading
    • Preprocessor
    • Primitive functions
    • Runetime Representations
    • input stdin
    • phm xt
    • ref counting methods
    • type famlies
    • type patterns
  • error messages
    • Anthropomorphic error essages
    • Colored error messages
    • Empty file error
View All Pages