On Saturday, April 4, 2015 at 9:04:10 AM UTC-5, Abe Schneider wrote:
>
> I should start off, not entirely sure this is an okay thing to do with
> Julia. Suppose I want to create a macro that generates another macro...
>
I'm not sure whether this should work or not, but either way I'm not sure
ho
The issue I'm dealing with is that I have a macro that I want to pass a
list of functions that the macro can employ for parsing grammars. The macro
itself exists already, and it currently has its own static list of
functions. I'm trying to figure out a way to allow the user of the library
to cu
I think the underlying issue may be that you are trying to have the macro
do too much, when you should instead be just doing source-code transforms
and preprocessing. One such example of a great use of a macro is simply:
macro special_foo(syntax_tree)
return quote
special_foo( $(QuoteN
I don't understand how what I'm trying to do falls outside the domain of
transforming code. My main goal is to take a user-defined grammar and
create relevant code.
More to the point, I think the general ability to generate expressions
based on functions/namespaces is also solidly in the domain
Let me ask the question slightly differently. Without constraining yourself
to legal Julia syntax, what would you like to go in, and what do you want
to come out? I get the feeling there's a design here that doesn't have this
complexity--my intuition is that a generic function can be used to dri
I think if I just copy bits of the current code in it might be the easiest.
I have the following macro:
macro grammar(name, definitions)
parsers = [:+, :*, :?, :|, :-, :^, :list, :integer, :float]
mapped_parsers = map_symbol_to_function(parsers)
return parseGrammar(name, definitions, Parser
If users should supply additional parsers (which parse sub-ASTs, right?) then
it's not really possible to hide all the metaprogramming machinery from them
anyway. So why not let the user create the macro, and just supply functions
that make writing the macro implementation as easy as possible?
That's definitely an option, though it seems sub-optimal to me if it's
possible to automate it from a user's perspective. It may be that it just
isn't possible, but if so, is it because it's something the language
doesn't currently support or does it go against the philosophy of the
language?