CodeX-API icon indicating copy to clipboard operation
CodeX-API copied to clipboard

[Enhancement] Add compilation/running of multiple files

Open YasserDbeis opened this issue 3 years ago • 1 comments

Future feature to be implemented: running code with multiple files.

This seems fairly straight forward with compiled languages. For example, for c/cpp we can send the code as an array of strings, have the file for each code string created, and the g++ command should take care of the rest in creating the executable. Some minor accomodations may need to be made to differentiate b/w header and non-header files, but that is not a big deal.

For interpreted languages, like python, I am not sure its as straight forward with the current mechanism. This is because if a python file imports from a file called "x", the imported filename will be modified to a UUID with the current set-up and thus the import statement will be broken. However, I might be misunderstanding and welcome criticism/solutions.

YasserDbeis avatar Jun 09 '22 07:06 YasserDbeis

@YasserDbeis I think you guys would need some sort of "module resolver" mechanism to create a dependency graph of the files before sending it to the server.

Later the server can flatten that data structure to resolve and load any missing modules.

But because there is no concept of a filesystem right now (I guess?) its more like a single evaluation call.

In a ideal architecture, the client could establish a WS connection with the server which can then be multiplexed to send different types of data like when the first time a enviornment loads, the client can send a Tree of files to the server which it can use to resolve file content.

This will also allow the server to pipe the STD inputs and outputs with using the WS with the client which can then be used to show a terminal view using something like https://xtermjs.org/

Haha these are just my suggestions from some experience with building such tooling, feel free to use if anything is useful to u. 😄

sidwebworks avatar Aug 02 '22 11:08 sidwebworks