Parse a .py file, read the AST, modify it, then write back the modified source code

I want to programmatically edit python source code. Basically I want to read a .py file, generate the AST, and then write back the modified python source code (i.e. another .py file). There are ways to parse/compile python source code using standard python modules, such as ast or compiler. However, I don’t think any of … Read more

Reading GHC Core

Core is GHC’s intermediate language. Reading Core can help you better understand the performance of your program. Someone asked me for documentation or tutorials on reading Core, but I couldn’t find much. What documentation is available for reading GHC Core? Here’s what I’ve found so far: Write Haskell as fast as C: exploiting strictness, laziness … Read more

Could not load file or assembly … The parameter is incorrect

Recently I met the following exception at C# solution: Error 2 Could not load file or assembly ‘Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6’ or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) This does not depend either on my code or on the name of assembly (like Newtonsoft.Json in this case). When … Read more

Writing a compiler in its own language

Intuitively, it would seems that a compiler for language Foo cannot itself be written in Foo. More specifically, the first compiler for language Foo cannot be written in Foo, but any subsequent compiler could be written for Foo. But is this actually true? I have some very vague recollection of reading about a language whose … Read more

Writing a compiler in its own language

Intuitively, it would seems that a compiler for language Foo cannot itself be written in Foo. More specifically, the first compiler for language Foo cannot be written in Foo, but any subsequent compiler could be written for Foo. But is this actually true? I have some very vague recollection of reading about a language whose … Read more