Thursday, December 24, 2009

How to combine several programming languages into one program?

I need to use Java and prolog for a project. The java code will output a string and prolog needs to do some processing on that string. So how do I pipe Java's output into prolog's input? (And then prolog's output must go into another program but that's another story...)How to combine several programming languages into one program?
You've probably answered your own question, actually. You should pipe the output from your java program to the input of your prolog program, and then on from there. This is usually done with the | character on the command line, though you should look up how it's done for your environment.





You could also spawn all of your programs from within java, write to their input and read from their output streams all from the java Runtime class... look up the exec methods.How to combine several programming languages into one program?
Not sure you can combine those languages. But if you use the new Visual Studio (VB.NET, C#, J#, ASP.NET, ADO.NET) they compile into a COMMON LANGUAGE RUNTIME file that can be written in any of those languages.
Seems like generally a bad idea unless absolutely necessary. Getting a non-trivial program ';knit together'; is often a headache.

No comments:

Post a Comment