Skip to content

Defines a sort of macro like language that can run any language in a text file and output the expanded result.

Notifications You must be signed in to change notification settings

markwatson/expander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Expander lets one run code in other code by allowing one to define functions
that are expanded out by executing them and putting their results back in the
file. The prupose is that given a file or directory, we can expand "macros"
using a given language.

For example:

Macro definition ("hello" is the name, and "python" is the language):
??defm:hello:python(arg1, arg2){{
print "puts 'Hello, %s!!!' \n%s" % (arg1, arg2)
}}

Macro call (eg, in ruby code):
??hello??'Joe'??'puts "Why, dude?"'??

Result:
puts 'Hello, Joe!!!'
puts "Why, dude?"

To call:
python expander.py [FILE|DIRECTORY]

If a file is passed in, the expanded output is printed to stdout. If a
directory is passed in, all files matching *.exp.* will be expanded into
*.* (the '.exp.' being removed).

About

Defines a sort of macro like language that can run any language in a text file and output the expanded result.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published