loading...

Cup: Would you like to see the ability to switch between languages that your code transpiles into

rohanthegreatt profile image rohanThegreaTT ・1 min read

As you know, my programming language cup transpiles into C. But what if you where a web developer that wanted use cup for web development? I think it would be cool to make the cup transpiler moddable to work with different languages for example, you could have a config file config.json that has what the different keywords and statements would be compiled into, for example:

{
"putchar":"console.log"
} 

For javascript. I just think it would be cool and would like to know if you lads thought it would be useful

Discussion

markdown guide
 

I think this would be a good idea, but I think you'd have to make the syntax for it a little more complex, since a language isn't just keywords, and symbols can have multiple meanings in different, or similar contexts. I hope this feedback helps, though maybe you'd compile it into a "command string" which only uses keywords and values, but I think it's simpler to do the former.
Good luck.
Cheers.

 
 

@rohanthegreatt I think it might be better to pass in an environment which is a pretty standard thing to have when using a compiler.

But yeah, that'd be cool!

 

ok, ill look into that, thanks