Live data from Hacker News

A functioning Turing Machine using Notepad++ and its find/replace regex engine

github.com

11–20 of 91 posts

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#12
post #3

I was under the impression that RegEx was not turing complete. Is there something special about N++’s regex engine that allows this?

No, nothing special about N++ (well, lookahead, but many regex engines have that). Repeated Search+Replace is the key, and not part of regex.

I find myself wondering if anyone has done a proper analysis to prove that human activity is Turing complete!

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#13
Neat, Though it does make me wonder if a python parser wont soon become standard in editors. Its just too damned convenient for many things, sure you might be able to come up with a regexp search and replace that does the same thing, but odds are it will take longer than coding a few loops. BASH sucked far too much, and C++ and most languages lacked the convenient filesystem libs required, but python just works and is easy to read and modify. The downsides of python, like the atrocious speed and low maintainability dont matter for scripts you will use just once.

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#16

I was under the impression that RegEx was not turing complete. Is there something special about N++’s regex engine that allows this?

It is proven that Turing machines can recognize a wider class of languages than Chomsky regular expressions. However, the article uses something more powerful than Chomsky regular expressions, because they contain backreferences (as \2 and \4), and also there is a repeated search-and-replace involved, which also adds to their power.

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#17
post #13

Neat, Though it does make me wonder if a python parser wont soon become standard in editors. Its just too damned convenient for many things, sure you might be able to come up with a regexp search and replace that does the same thing, but odds are it will take longer than coding a few loops. BASH sucked far too much, and C++ and most languages lacked the convenient filesystem libs required, but python just works and i…

Python just works... Every now and then I'm still bitten by the 2->3 transition. And I'd very much not like it to be a required dependency in my systems either.

And no, regexps get a bad rep but they are for the easy 99% and insanely quick to come up with. Learn basic syntax and you'll be thankful for decades to come.

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#18
post #13

Neat, Though it does make me wonder if a python parser wont soon become standard in editors. Its just too damned convenient for many things, sure you might be able to come up with a regexp search and replace that does the same thing, but odds are it will take longer than coding a few loops. BASH sucked far too much, and C++ and most languages lacked the convenient filesystem libs required, but python just works and i…

I wouldn't be happy with Python, but I do agree with the general premise that extensibility or automation ought to be expected of editors.

My own editor is written in Ruby, and so all extension is done by loading Ruby code into the running process, and I can drop into the Pry debugger with a keypress, or another keypress gives me a prompt to enter a single-line expression instead. The latter is literally a one-line method. Adding a binding to eval() a whole buffer would be equally trivial... Being able to extend everything trivially in a language I'm comfortable with (so not Emacs lisp) makes such a difference to usability.

Incidentally, the ability to interact with the open buffers using a script also from outside the editor is another thing I love as an extension mechanism for editors - an idea I first saw in FrexxEd (co-written by the founder of Curl) for the Amiga, which exposed the open buffers in the filesystem (think the Amiga equivalent of a FUSE filesystem), which would have the added benefit of not being language specific. It doesn't need to involve any FUSE-like stuff either - just a command line utility to "cat" an open buffer and to replace the open buffer from stdin would be sufficient.

Re: A functioning Turing Machine using Notepad++ and its find/replace regex engine

#20
post #3

Earlier quoted context omitted.

No, nothing special about N++ (well, lookahead, but many regex engines have that). Repeated Search+Replace is the key, and not part of regex.

I find myself wondering if anyone has done a proper analysis to prove that human activity is Turing complete!

We can manually execute the steps of a Turing machine. That's all that's needed.
Post reply on HN