interpreter

programming language implemented in pure python

一曲冷凌霜 提交于 2019-12-06 12:45:05
问题 i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any programming language implemented in pure python which i can see as a reference ( or use directly ? ) -- i need simple language ( simple statements and ifs can do ) edit: sorry if i

How to intercept LLVM lli tool input?

久未见 提交于 2019-12-06 11:54:53
I'd like to use LLVM lli tool as static library (rename main() to lli() and export it in libLLi.a) - to create rich UI for it. How can i modify it (or use without modifications) in order to intercept stdin? Assume i know how to generate LLVM assembly file (using clang -S -emit-llvm .. -o output.ll ) and how to execute it using lli tool ( lli output.ll ). Common use case: Source code of simple app to be interpreted by lli: #include <iostream> using namespace std; int main() { char name[128]; cout << "type your name: "; cin.getline(name, sizeof(name)); cout << "hi, " << name << endl; return 0; }

Python Interpreter Mode - What are some ways to explore Python's modules and its usage

柔情痞子 提交于 2019-12-06 03:54:15
While inside the Python Interpreter: What are some ways to learn about the packages I have? >>> man sys File "<stdin>", line 1 man sys ^ SyntaxError: invalid syntax >>> sys --help Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: bad operand type for unary -: '_Helper' Corrected: >>> help(sys) ... Now, how do I see all the packages available to me on my sys.path? And see their subsequent usage and documentation. I know that I can easily download a PDF but all this stuff is already baked in, I'd like to not duplicate files. Thanks! You can look at help("modules")

Looking for a locked down script interpreter [closed]

元气小坏坏 提交于 2019-12-06 02:30:50
I'm looking for a .NET library that does a specific task. Say my app has been sent a program (in some script language) and I want my app to run that script. That script could come from an openly hostile individual, but I want to run it anyway. (Like JavaScript in a browser.) var sc = new SecureScript("SomeFileFromAnUnknownPossiblyHostileSource.xyz"); /* Set some event handlers. */ sc.Run(); During the Run call, the script could construct it's own data, mess around with simple data types, do whatever it wants as long the effects are contained within it's own world. If the script attempts to

How to get python interpreter path in uwsgi process

Deadly 提交于 2019-12-06 02:19:44
How can I get python interpreter path in uwsgi process (if I started it with -h parameter)? I tryed to use VIRTUAL_ENV and UWSGI_PYHOME environment variables, but they are empty, I do not know why. Also i tryed to use sys.executable , but it points to uwsgi process path. uWSGI is not a python application (it only calls libpython functions) so the effective executable is the uwsgi binary. If you use virtualenvs you can assume the binary is in venv/bin/python 来源: https://stackoverflow.com/questions/18014122/how-to-get-python-interpreter-path-in-uwsgi-process

Is it possible to explicitly free memory with JVM Bytecode?

允我心安 提交于 2019-12-06 01:51:05
问题 There are several computer programming languages using JVM bytecode as, lets say, target language for their interpreter/compilers. It seems to me that many new programming languages (less than 15 years old) run over JVM and I wonder whether explicit memory deallocation is forbidden for all of them: Is it possible to explicitly allocate-deallocate memory using in bytecode through any instruction? Is, on de contrary, the garbage collector always resposible for memory liberation? 回答1: The JVM

Eclipse: connect to custom python interpreter with PyDev

浪子不回头ぞ 提交于 2019-12-06 00:31:22
I love Eclipse and PyDev because it always has the features I need. This time I'd like to connect PyDev to my interpreter that is already running. My interpreter is embedded in my game application, that's why. If it would make it easier, I can also start the game application from Eclipse. However, I've tried to add my game .exe in the interpreter configuration in PyDev but it cannot be started because the .exe need some .cfg files that are located in the .exe's folder. Ecplise seems to not execute the .exe file in its environment. How could I do it? The main reason for all this is that I want

Implementing Brainfuck loops in an interpreter

為{幸葍}努か 提交于 2019-12-05 20:22:42
问题 I want to build a Brainfuck (Damn that name) interpreter in my freshly created programming language to prove it's turing-completeness. Now, everything is clear so far ( <>+-,. ) - except one thing: The loops ( [] ). I assume that you know the (extremely hard) BF syntax from here on: How do I implement the BF loops in my interpreter? How could the pseudocode look like? What should I do when the interpreter reaches a loop beginning ( [ ) or a loop end ( ] )? Checking if the loop should continue

How to build an interpreter for a small language? [closed]

二次信任 提交于 2019-12-05 20:10:38
I'm trying to figure out where to start with this project. Perhaps someone can steer me in the right direction. I am given a small language that I must write an interpreter for. The language consists of either an expression in parentheses: (integer integer operator) or an arithmetic IF statement made up of expressions in the form: IF exp1 exp2 exp3 exp4 where exp2 is returned if exp1 is negative, exp3 is returned if exp1 is zero, and exp4 is returned if exp1 is positive. The operator is either + or x (for addition and multiplication respectively). I have to implement a scanner/parser together,

How are Function objects different from Normal objects?

試著忘記壹切 提交于 2019-12-05 14:57:31
How are functions stored in a variable? According to MDN In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects. Suppose this scenario, var fn = function () {}; fn.attr = 3; console.log(fn); //prints function() {} console.log(Object.keys(fn)); //prints ["attr"] If a function is an object shouldn't it have keys and value kind where the function is stored in a property and the interpreters don't show that property?