Live data from Hacker News

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

github.com

31–40 of 91 posts

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

#31
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've needed such functionality often enough that i wrote a small utility[0] that uses my LIL scripting language[1] (similar to Tcl) to process some text and have its output. A couple of examples are in the shots [2][3] (note that as this is written in Lazarus it also works under Linux and Mac too, though the site only has a Windows executable).

Before that i used to write scripts or even full programs (in Free Pascal which has some simple string handling) to do similar processing and i did find it much more cumbersome to go through that route.

Of course this only works for editing/generated/transforming text pieces (and i pretty much always use it via clipboard), for processing files i still end up writing full scripts or programs (depending on the case, if i need to preprocess stuff i use another LIL-based tool, lip[4]).

[0] http://runtimeterror.com/tools/liteproc/

[1] http://runtimeterror.com/tech/lil/

[2] http://runtimeterror.com/tools/liteproc/shot.png

[3] http://runtimeterror.com/tools/liteproc/shot2.png

[4] http://runtimeterror.com/tools/lip/

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

#33
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…

That sounds like a felony abuse of Python. Despite, wasn't perl originally a tragic attempt at such language? :)

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

#34
post #26

Earlier quoted context omitted.

Learn basic syntax and you'll spend the next few decades wondering each time _which_ basic syntax is expected because none of them ever say.

I know the basic syntax and I never have that problem. Perhaps you mean the advanced syntax? However I don't see the problem, there either. I usually don't need it, and to be honest, when I do, I find it more maintainable to use multiple simpler expressions combined with some programming.

Some by "regex" mean "globs" and you can just use "*" and "?" for stand-ins for some number of characters.

Some allow "|", some allow backrefs, some allow "()", or require them escaped with \, or allow them but not with * after. Some are case insensitive, some not. Some allow "{0-5}", some allow "[0-9]", some have handy things like "\w".

It's just the guessing game of exactly what they want. It should be required that each regex box has an example next to it using as many allowed features as possible.

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

#35
post #10
post #9

Not a Turing machine if the user has to press a button for each step.

That's not relevant as to whether it's a turing machine or not, tho... The possible calculations (and genericity) is what matters. The "button for each step" could be analogous to powering the turing machine, or turning some crank for Babbage's machine, or whatever..

…or clicking the On-Click Transitions in Microsoft® PowerPoint™…

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

#36
post #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.

Do you mean Chomsky hierarchy by Chomsky regex?

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

#37

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

It seems Notepad++'s "search + replace all" feature replaces text in place inside a search context rather than buffering the changes and applying them outside a search context after the search is complete. This makes search recursive.

When combined with enhanced regexes (backreferences and lookahead), you have the ingredients for Turing completeness.

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

#38
post #18

Earlier quoted context omitted.

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 m…

Out of curiosity, what do you actually use the Ruby liveloading feature for? I use Neovim, which has a similar (but less powerful) feature that allows one to live-execute Lua code (or Vimscript, I suppose). But I almost never use it outside of testing code for my configuration, because the rest of the editor's feature set suffices fairly well for text editing.

Vim can run Ruby scripts, so it also provides this feature.

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

#39

Earlier quoted context omitted.

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

We are guaranteed to halt, e.g lifespan. After death cells enter apoptosis stage where cells do final stages upon shutting down. I’d say it appears we are Turing complete, or at least it appears so from this angle

How about a human population?

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

#40
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've needed such functionality often enough that i wrote a small utility[0] that uses my LIL scripting language[1] (similar to Tcl) to process some text and have its output. A couple of examples are in the shots [2][3] (note that as this is written in Lazarus it also works under Linux and Mac too, though the site only has a Windows executable). Before that i used to write scripts or even full programs (in Free Pascal…

I used to have a Perl script, bound to a key chord, that would pop a dialog box prompting for a s/// regexp-replace expression and apply it to the clipboard contents.

Never got around to making it properly interactive, because I stopped needing it when I switched to Emacs and had both its native capabilities and C-u M-| available.

Post reply on HN