Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Writing a Limited Interpreter

Name: Anonymous 2012-11-23 5:23

How would I go about writing an interpreter for a programming language which has limited/indirect access to another language's standard library, and no direct File IO.

That is, if I want to use File IO, the new language wouldn't get direct access to files, it would have to go through a buffer in the interpreter that prevents read/write of files not in the sandbox.

I need to be able to interpret it from inside either Java or .NET (I can do native access if I have to, but I'd prefer to avoid it).

Name: Anonymous 2012-11-23 6:18

It is called FFI (Foreign Function Interface) and you must provide facilities for linking with libraries and calling ``C'' procedures stored in them (including libc's procedures for file IO).

Name: Anonymous 2012-11-23 8:32

Uh, implement the fopen() function in your interpreter so that it uses a buffer instead of calling the actual function? Sorry, I don't understand your question, I don't think it's that retarded.

Name: Anonymous 2012-11-23 8:59

>>1
It's pretty straight forward when you're doing an interpreter OP. Your language should be sandboxed in such a way that it's presented with a whitelist of accessible files or even better a way to define and expose a virtual file system.

Think it over, it's not that hard conceptually.

Don't change these.
Name: Email:
Entire Thread Thread List