Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: rockbrentwood@gmail.com Newsgroups: comp.compilers Subject: Can vi emulate the power of yacc? Date: Fri, 13 Mar 2020 00:56:01 -0700 (PDT) Organization: Compilers Central Lines: 8 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <20-03-014@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="55127"; mail-complaints-to="abuse@iecc.com" Keywords: syntax, question Posted-Date: 13 Mar 2020 08:26:35 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2485 There are 3 ingredients in vi which, when combined, via the Chomsky-Schuetzenberger Theorem, may give it the power to fully emulate simple syntax direct translations and push down transducers ... and possibly even syntax directed translations. (1) "%" to match brackets; with the important condition that this works on at least 2 different kinds of brackets (2) the regular expression facility; particularly its ability to name and use parameters (3) the search & replace function. So, here's a simple challenge of sorts to test the idea: write a vi script that converts between infix and postfix order with at least two levels of operator precedence. I don't know if it can actually be done.