This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JavaScript/EcmaScript interpreter


Hi.

I am Lach Sławomir from Poland, Bytom. I am beginner developer in
C/C++, Python, TypeScript, EcmaScript, etc.

I'm wonder how wonderful stuff can be done if GNU Compilers Collection
allow developers to use JavaScript inside other language code as
preprocessor.

- Developer could use arrays
- Developer could use more generalized functions
- Developer could use custom code analyze (as compiler extensions)
- JavaScript will be ran in sandbox, so maybe use it instead configure
scripts and instead make?
- Developer could use JavaScript regular expressions to replace text in
files
- Possible many others

I think, you could use modified version of node.js as C/other language
preprocessor. I don't have idea how things should be done yet, but I'm
ready for discussions.

One example:
#JS_DEFINE("UNPACK",['string','string'], function(a, b)
{
   unpacked_symbols[unpacked_symbols.length] = b;
   document.write("#define b a . b");
})

#JS_DEFINE("}", [], function() {

  for (a in unpacked_symbols)
  {
     document.write("#undef a");
  }
  delete unpacked_symbols;
}

That's very simple example. Could it be useful?

Best regards,
Lach Sławomir.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]