I have a very simple sweet.js file I'm trying to compile:
macro @ {
rule {
$exp
}=>{
+ $exp +
}
}
...using this command:
sjs -o out.js my_file.js
But nothing is getting output; the out.js file is created, but it doesn't contain anything. At first I thought it may be any issue with the sweet.js file itself, but when I test it using the sweet.js online editor, it works as expected.
Am I not using the 'sjs' command properly? Is there something else I'm overlooking?
I was able to compile after adding some lines of code outside of the macro definition:
macro @ {
rule {
$exp
}=>{
+ $exp +
}
}
var msg = "Hello";
console.log("message is: " @msg ".");
I misunderstood the documentation I've been reading, and thought just the macro code itself could be compiled into a JavaScript file, but the compiler spits out a JavaScript file based on the defined macro and the code that utilizes the defined macro.