I know Rascal is intended to be a meta-language for other languages. Do these languages include Rascal itself? Is there any meta-facilities like quote a la Lisp available or planned?

有帮助吗?

解决方案

You can transform Rascal using Rascal by including the Rascal syntax definition and simply using the normal quotes. We are not planning to add quoting at run-time for Rascal itself afaik.

One thing that I forgot to mention earlier, is that the "resources" mechanism can be used to manipulate Rascal code at "import" time. You can write any function as in:

@resource{myScheme}
str generateNewCode(str name, loc l) = ...

generateNewCode should generate a Rascal module with name name.

After this you can import as follows:

import MyModule = myScheme://someOtherModuleName;

And then the module that is generated by generateNewCode is imported by Rascal in the module that you typed the import in.

Nothing stops you from writing a generateNewCode function that parses another module, rewrites or extends it and then will be imported.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top