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 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • 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.
Show 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
Copy this template traversal header code into the file you created in step 2.
```c
/** <!-**********************************************************-->
#ifndef _SAC_TRAVTEMPLATE_H_
#define _SAC_TRAVTEMPLATE_H_
/*******************************************************************
* author: <Your name>
* created-at: dd-mm-yyyy
* description:
......@@ -128,8 +131,6 @@ Copy this template traversal header code into the file you created in step 2.
* Prefix: TEMP
*
*********************************************************************/
#ifndef _SAC_TRAVTEMPLATE_H_
#define _SAC_TRAVTEMPLATE_H_
#include "types.h"
......@@ -207,14 +208,17 @@ struct INFO {
node *fundef; // some random info
};
node *EXdoExampleTraversal (node *syntax_tree) {
node *
EXdoExampleTraversal (node *syntax_tree) {
return syntax_tree;
}
node *EXmodule (node *arg_node, info *arg_info) {
node *
EXmodule (node *arg_node, info *arg_info) {
return arg_node;
}
node *EXfundef (node *arg_node, info *arg_info) {
node *
EXfundef (node *arg_node, info *arg_info) {
return arg_node;
}
```
......@@ -238,12 +242,8 @@ There is also a template for your traversal `.c` file, here it is:
*
* @brief short description
*
* description:
* Longer traversal description goes here with examples.
*
* example:
*
* @{
**********************************************************/
#include "template_traversal.h" // update to your .h file
......@@ -367,8 +367,6 @@ DummyStaticHelper (node *arg_node)
DBUG_RETURN (arg_node);
}
/* @} */
```
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