How to use third party libraries with Scala REPL?

Of course, you can use scala -cp whatever and manually manage your dependencies. But that gets quite tedious, especially if you have multiple dependencies. A more flexible approach is to use sbt to manage your dependencies. Search for the library you want to use on search.maven.org. Algebird for example is available by simply searching for … Read more

Python Compilation/Interpretation Process

The bytecode is not actually interpreted to machine code, unless you are using some exotic implementation such as pypy. Other than that, you have the description correct. The bytecode is loaded into the Python runtime and interpreted by a virtual machine, which is a piece of code that reads each instruction in the bytecode and … Read more

How to fix column calculation in Python readline if using color prompt

I open info readline and found: — Function: int rl_expand_prompt (char *prompt) Expand any special character sequences in PROMPT and set up the local Readline prompt redisplay variables. This function is called by `readline()’. It may also be called to expand the primary prompt if the `rl_on_new_line_with_prompt()’ function or `rl_already_prompted’ variable is used. It returns … Read more

Constructing an Abstract Syntax Tree with a list of Tokens

The fundamental trick is to recognize that parsing, however accomplished, happens in incremental steps, including the reading of the tokens one by one. At each incremental step, there is an opportunity to build part of the AST by combining AST fragments built by other incremental steps. This is a recursive idea, and it bottoms out … Read more

Alan Kay’s Eval/Apply Einstein Moment

There are two different issues: First: Dynamic binding as a bug Not sure what he means, but generally in McCarthy’s EVAL the use of dynamic binding can be seen as a bug. He does not implement lexical scope for variables. The bug shows up for example here: http://www-formal.stanford.edu/jmc/recursive/node3.html See the functions maplist and diff. Both … Read more

Learning Resources on Parsers, Interpreters, and Compilers [closed]

The best paper I ever read on compilers is dated 1964 “META II a syntax-oriented compiler writing language” by Val Schorre. (http://doi.acm.org/10.1145/800257.808896) In 10 pages, he shows you how to build an astoundingly simple but very effective compiler-compiler, provides you with with the compiler-compiler grammar and provides you with enough details for you to hand … Read more