Let's say you are implementing an interpreter for a GCed language in a language that is GCed.
It seems to me you'd get garbage collection for free as long as you are reasonably careful about your design.
Is this generally how it's done? Are there good reasons not to do this?
...
Assuming the interpreter for the language (Can be anything from PHP to Ruby) is written in C.
How are variables (or more complex data structures not only containg name and value), which are defined by the script that is currently being executed, stored and read out?
I, with my rather poor knowledge of C, would end up with the conclusion...
Whilst creating an inline ANTLR Tree Grammar interpreter I have come across an issue regarding the multiplicity of procedure call arguments.
Consider the following (faulty) tree grammar definition.
procedureCallStatement
: ^(PROCEDURECALL procedureName=NAME arguments=expression*)
{
if(procedureName.equals("foo...
I'm calling python -m pdb myapp.py, when an exception fires, and I'd normally be thrown back to the pdb interpreter to investigate the problem. However this exception is being thrown after I've called through curses.wrapper() and entered curses mode, rendering the pdb interpreter useless. How can I work around this?
...
Hi,
I'm writing a small interpreter for a simple BASIC like language as an exercise on an AVR microcontroller in C using the avr-gcc toolchain. However, I'm wondering if there are any open source tools out there that could help me writing the lexer and parser.
If I would write this to run on my Linux box, I could use flex/bison. Now th...
Most things that look like operators are methods in Ruby; 1 + 2 is syntactic sugar for 1.+(2).
Even though + and * are methods that a program can redefine, Ruby has special magic to evaluate 1 + 2 * 3 as 1.+(2.*(3)) instead of 1.+(2).*(3).
I wonder where this special magic lives in Ruby--if it is hard-wired into the interpreter.
Ari.
...
I have heard of deferred evaluation in python (for example here), is it just referring to how lambdas are evaluated by the interpreter only when they are used? Or is this the proper term for describing how, due to python's dynamic design, it will not catch many errors until runtime?
Or am I missing something entirely?
...
What kind of advantages are there to changing 'cond' to be a special form instead of syntactic sugar?
...
How does an interpreter/compiler work? What is the difference between interpreter and compiler.
...
What is the runtime? And I don't mean "at run time" = as the program/script is running. I mean
The <your-interpreted-language-here> runtime
...
Is there a difference in performance (I am not asking about readability) if I condense my code into one line versus two?
For example:
var slide = 'images/' + n + '.png';
$('img').attr('src',slide);
versus
$('img').attr('src','images/' + n + '.png');
Personally, I like fewer lines of code. Often, I am the only one reading my co...
I'm creating a game in XNA and was thinking of creating my own scripting language (extremely simple mind you). I know there's better ways to go about this (and that I'm reinventing the wheel), but I want the learning experience more than to be productive and fast.
When confronted with code at run time, from what I understand, the usual ...
What are the differences between a Just-in-Time-Compiler and an Interpreter, and are there differences between the .NET and the JAVA JIT compiler?
...
Hi, i'm looking for a way to ship the python interpreter with my application (also written in python), so that it doesn't need to have python installed on the machine.
I searched google and found a bunch of results about how to embed the python interpreter in applications written in various languages, but nothing for applications writte...
Whitespace Assembler
#! /usr/bin/env python
"""Assembler.py
Compiles a program from "Assembly" folder into "Program" folder.
Can be executed directly by double-click or on the command line.
Give name of *.WSA file without extension (example: stack_calc)."""
##############################################################################...
Hi,
I need to build a component which would take a few XML documents in input and check the following kind of rules:
XML1:/bookstore/book[price>35.00] != null
and (XML2:/city/name = 'Montreal'
or XML3://customer[@language] contains 'en')
Basically my component should be able to:
substitute the XML tokens with the correspondin...
hi, 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 ...
I'm doing a survey of features in preparation for a research project.
Name a mainstream language or language feature that is hard to optimize, and why the feature is or isn't worth the price paid, or instead, just debunk my theories below with anecdotal evidence. Before anyone flags this as subjective, I am asking for specific examples ...
I quickly wrote an interpreter for some sort of experimental programing language i came up with, in PHP (yes, in PHP). The language itself doesn't have anything really special, I just wanted to give it a try.
I got the basic things working (Hello World, input to output, string manipulation, arithmetics) but I'm getting stuck with the ma...
I'm talking about C and/or C++ here as this are the only languages I know used for interpreters where the following could be a problem:
If we have an interpreted language X how can a library written for it add functions to the language which can then be called from within programs written in the language?
PHP example:
substr( $str, 5,...