[PATCH] D19237: ELF: Add +, -, *, / and & to SECTIONS linker script command.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:08:52 PDT 2016


grimar added a comment.

In http://reviews.llvm.org/D19237#405186, @ruiu wrote:

> It uses recursion because the grammar is recursive. Do you find the recursive-descendent parser is hard to read because it uses recursion? Even if your code does not make recursive function calls, you have to handle recursive grammar using some recursive data structure (such as hand-crafted stack rather than call stack.)
>
> Nothing is special in my code, it is a plain operator-precedence parser. If you write a parser for a calculator-ish grammer, and if you don't need a parser tree, then I think that the operator-precedence parser is usually the first choice. It is common technique so readers don't have to take a look at every detail of the code; it can be understood just by reading the comment that this is an operator-precedence grammar, because the implementation is obvious as long as you are familiar with the theory. If we have a reason to create an intermediate representation of an expression, then doing it in your way might make sense, but I think that's not the case.


I can say the same about mine, RPN building and evaluating is also known and used often technique.
I see nothing bad in intermediate representation, it does not waste time to be created as complexity almost lowest possible and
I see no reasons why not to use it when overall readability is improved (IMO).
At the same time I am not sure this worth such long arguing. Lets go with your version if you want. 
I`ll keep my opinion about mine one though :)


http://reviews.llvm.org/D19237





More information about the llvm-commits mailing list