Macros are defined by double brackets []. Macros tell to the wiki parser to replace an input pattern with specific output.
An example macro: [[Foo(bar,barbar,barfoo)]]
In Sycamore, the macro script is found in Sycamore/macro/foo.py
The function the macro calls when it's run is execute, E.g. def execute(macro, args, formatter). The argument macro is a copy of the macro object. The macro object contains things such as the request object and the parser object. The argument args is a string, which is exactly what is in the () in the call. In the above example, this would be "bar,barbar,barfoo". The formatter argument is a copy of the formatter object (which renders wiki markup tokens into HTML). For instance, to create a linebreak in the HTML without actually doing macro.request.write("<br/>") you could call macro.formatter.linebreak(0). More examples can be found throughout the code.