recursive descent parser and functional programming

Answer derived from this blog article: So my question is what would a more traditional functional approach to parsing (i.e. few side effects) look like? Sounds like you need to separate functional (as in Lisp, Scheme, Standard ML, CAML, OCaml, F#) from purity (absence of side effects, as in Haskell) and incidental language features (algebraic … Read more

Are there Lisp native code compilers?

Many Lisp compilers compile to ‘native’ code. ‘Native’ means here ‘machine code’ (x86 in 32bit or 64bit mode, PowerPC, SPARC, …). Other questions: can ‘non-native code’ compilers generate single file executables? -> Yes. can ‘native code’ compilers generate single file executables? -> Yes. how ‘native’ is ‘native’? -> Lisp system will most of the time … Read more

What does a JIT compiler do?

Java code is normally distributed as bytecode, which is machine-independent pseudocode. (The same idea was previously used in UCSD-p system developed in the 70’ies.) The advantage of this is that the same application can be run in different processors and operating systems. In addition, the bytecode is often smaller than compiled application. The disadvantage is … Read more

Which contemporary computer languages are LL(1)?

I think I’d be tempted to flag that Wikipedia quote with [citation needed]; the assumptions are, at least, questionable. For example, there are a large number of compiler-construction tools based on yacc which make it extremely easy, in practice, to construct a parser using the more powerful (and equally fast) LALR algorithm, and some also … Read more

Wanted: good definition of the term “lowering” in the context of compilers

Dr. Dobbs just published an article by Walter Bright (of dlang fame), where he mentions the term: Lowering One semantic technique that is obvious in hindsight (but took Andrei Alexandrescu to point out to me) is called “lowering.” It consists of, internally, rewriting more complex semantic constructs in terms of simpler ones. For example, while … Read more

How to tell if a binary is release or debug in both win and *nix

for C++ on Linux, you can do: objdump –source yourbin |grep printf Replace printf with whatever function call you do. If it is debug, it will display all the actual source code call you do. If it is release, it will just display the founded symbol from the symbol table. for C++ on Windows, you … Read more

How does the Erlang compiler implement pattern matching?

A very good description of compiling pattern matching is given in “The implementation of functional programming languages” by Simon Peyton Jones. It is a bit old but a very good book. It also contains, amongst other things, a description of compiling list comprehensions. The Erlang compiler uses both of these algorithms from the book.

Interpreters vs Compilers vs Virtual Machines

A virtual machine isn’t exactly an alternative to compilers or interpreters. I think you are thinking of a JIT compiler, which is how many VMs are implemented. A virtual machine itself is exactly what the name says – it’s a machine (processor) that doesn’t actually exist. For example, most processors don’t have any intrinsic way … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)