employer cover photo
employer logo
employer logo

Maxeler Technologies

Is this your company?

Maxeler Technologies interview question

Which language to use when building a compiler, python or java?

Interview Answers

Anonymous

Dec 19, 2014

The intention of the question is to see whether you are the sort of person who must know everything about everything. Suggesting Python or Java is a bit of a distraction. A good answer to the question would be along the lines of: "Well there are various compiler-generators, such as Yacc or Bison, if you can get those to do what you want then that is a quick win for small time investment. Then if you really must do it yourself, then a compiler has a layered design. Top layer is text-parsing from Baccus-Nau specification and Regex, So historically a language that was strong on text would be good here, e.g. Perl. Although now there is regex support in C++ and Java, so we've got more options. Middle layer is building a Graph of the code structure, then parsing the graph to remove/optimize the nodes, so a language that has good support for graphs and data structures is good here (need examples of languages, maybe some of the Functional Languages would suit this better than OO languages?) Bottom layer converts the nodes in the graph into Pseudo-code and then into assembler. And then there may be optimizations that can be applied by "peep-hole" looking for localized chances to rewrite or re-order op-codes to remove redundancy. Again need language examples."

2

Anonymous

Mar 26, 2014

No idea.