Live data from Hacker News

Ydiff: Structural Comparison of Programs

yinwang0.wordpress.com

31–35 of 35 posts

Re: Ydiff: Structural Comparison of Programs

#31

This is great. I've wanted to build a similar tool for a couple of years, the distinction being that I want a structural grep utility. I'd pass in a pattern in the form of a code snippet (with pattern operators), and have the thing search for matching code structures. I suspect that this tool does 95% of what would be needed for that, very nice.

It's not what you want, but, as perhaps a first step, there's an SGML sgrep (http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html). Perhaps one might combine it with programming based on Oleg's SXML (http://okmij.org/ftp/Scheme/xml.html) and similar.

EDIT (fixing formatting, and …): I knew something else was nagging at me. The idea of a structural grep makes me think of Rob Pike's structural regular expressions (http://doc.cat-v.org/bell_labs/structural_regexps). The Sam editor (http://sam.cat-v.org) is based on this, and I thought I remembered a more modern version called something like 'e'; but, of course, such a name is impossible to Google.

Re: Ydiff: Structural Comparison of Programs

#33
post #5

Lovely to see Racket being used. Given the pure meta-ness of Racket hopefully ydiff will not only evolve into a full-fledged version control system but a completely configurable one at that, akin to the power of Emacs and it's Lisp. Having something like a .yinrc where I could quickly throw around and test out custom functionality would be awesome. I haven't gotten much into git's plumbing yet, but I don't see a cult…

In my experience, git has that culture of hacking, but it isn't as visible. Things get added to the "contrib" folder pretty quickly; but few ever get the polish to graduate out. On my box, contrib is installed at `/usr/share/git/`.

Just create an executable named git-WHATEVER and put it somewhere in $PATH (or $GIT_EXEC_PATH).

Re: Ydiff: Structural Comparison of Programs

#34
post #25

Earlier quoted context omitted.

I don't see why a variable can't have a "name" property, even if it's not used as pointer value. I don't see why ASTs should have less information than source code. IMO they're equivalent, and just different forms of representation. ASTs are easier to manipulate with code, source code is easier to manipulate with text editors. We don't really have good tools for manipulating ASTs yet.

The same amount of information exists, but is normalized. The variable _definition_ absolutely will have a "name" annotation, but copying that name to each binding site is brittle. To render a binding, just dereference the pointer to the original definition and use its name. I'm working on it.

Me too. :)

Re: Ydiff: Structural Comparison of Programs

#35
post #31

This is great. I've wanted to build a similar tool for a couple of years, the distinction being that I want a structural grep utility. I'd pass in a pattern in the form of a code snippet (with pattern operators), and have the thing search for matching code structures. I suspect that this tool does 95% of what would be needed for that, very nice.

It's not what you want, but, as perhaps a first step, there's an SGML sgrep ( http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html ). Perhaps one might combine it with programming based on Oleg's SXML ( http://okmij.org/ftp/Scheme/xml.html ) and similar. EDIT (fixing formatting, and …): I knew something else was nagging at me. The idea of a structural grep makes me think of Rob Pike's structural regular expressions ( http…

Awesome, thanks for the links.
Post reply on HN