Interface for AST rewriting

rewrite(ast, rules)

Arguments

ast

A language object.

rules

A list of functions, each of which is the output from `make_rule`.

Value

A language object.

Examples

library(rockstaR)

rule = make_rule("nothing", "NULL")
lyrics = "Rockstar is nothing"
rewrite(lyrics, list(rule))
#> [1] "Rockstar is NULL"