Some MELT related questions

8 views
Skip to first unread message

sanelz

unread,
Apr 12, 2013, 10:06:04 AM4/12/13
to gcc-...@googlegroups.com
Hi developers,

First of all, thanks for giving us MELT; now we, mortals, can play
with gcc internals :)

I have few questions related to MELT language (and/or inner working)
I wasn't able to find online, so hoping direct mail and chatting will
speed up the things :)

I'm working on a bit largish OSS C++ project, and would like to reuse
MELT for some inspection, code injection and etc. In short, do some
cool stuff.

Here are my questions:

* Is it possible to use MELT to rewrite the code? For example, I
  populate on various places some placeholders (like
  '__magic_func_foo()') and upon some condition MELT removes it or
  replaces it with desired code?

  If I understood correctly, matcher will do this without problems, right?

* Does MELT support Scheme/CL style macros, like:

 (defmacro adder (a b)
   `(+ ,a ,b))

 I found some macro mentioning inside documentation, but wasn't able
 to figure out how to use it. How hard will be to add it? I'm long
 time scheme/CL user, so using lisp-like language without macros is
 quite handicap to me :)

* Can MELT load other MELT code, like:

  (load "helpers.melt")

  I'm planning to (at some point) write library that will simplify
  matching by using regex style expressions. Just for fun and see how
  it will work.

* Does MELT support numeric or other evaluation in REPL? I tried with
  few '(+ 1 2 3)' but wasn't getting anything.

  My wish is to use REPL for (beside playing with gcc internals)
  other tasks, like defining new MELT functions, macros, doing some
  arithmetic and etc.

* Can I extend MELT by calling external C methods, like regcomp(),
  system calls and etc? Or even better (since MELT access gcc internals),
  can it call C++ members?

* Is it possible to embed REPL inside GUI and evaluate expressions
  from there?

Huh, hoping I didn't ask too much :)

Best,
Sanel
Reply all
Reply to author
Forward
0 new messages