Jump to content

Talk:Operator-precedence parser

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Antinice (talk | contribs) at 12:43, 17 April 2007 (Implementation usually highlights a precedence table). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

I rewrote the parenthesis-insertion code to present the essence of the algorithm with less distracting C-machination (eliminated a couple of tables & some peculiar end-cases, open-coded a loop) -- and to make lines shorter, and to make gcc -Wall compile it without complaint. I'll note here that it doesn't do anything about getting operator associativity right. In particular, using the usual rules, a^b^c should come out to a^(b^c) while a-b-c should be (a-b)-c. The present program adequately parenthesizes neither. Tom Duff 19:20, 23 August 2006 (UTC)[reply]

While I'm here, it would be a good idea for some motivated person to rewrite the pseudo-code for the railway-siding algorithm in C or something. Tom Duff 19:28, 23 August 2006 (UTC)[reply]

This is the first time I've seen an operator precedence parser explained with no stack and precedence table. The elegence of such implementations are irresistable. While i'm not about to argue with any fact in the original article, I think it warrants a shout-out. Antinice 12:43, 17 April 2007 (UTC)[reply]