[racket] structural program comparison tool in Racket
Hi Eli,
Thanks a lot for the thoughts!
> IOW, I think that it would be nicer to have a good api for the tool,
> something that takes two files (or two pieces of text) and returns the
> representation of the additions/deletions and the mapping between
> chunks of text that is the same. This way instead of one tool that
> you (Yin) write, many people can write many tools.
I especially like this one. Since it is too much work building all the
parsers for all the languages (currently the C++ and JS parsers are
still at experimental stage), I'm designing a "interchange format" of
ASTs so that the tool can be used as both a command line program and a
library. I hope to let the compiler writers add an option of
outputting the interchange format, so that can be "piped" into the
diff tool.
I haven't thought of _outputting_ a interchange representation of the
"changes", and that's a good idea. Indeed there are lots of things we
can do with the changes and that part can be modularized. btw I think
the changes can be thought of as transactions in a database system.
> * It could be used in tools that show two pieces of similar text. Two
> cases of that are the usual stepper and the macro one. They could
> use it to render just the differences between two adjacent texts.
> Although in both of these cases the tools themselves have their own
> semantic information that is more precise, my guess is that your
> tool will work fine in most practical cases, and could be used for
> similar tools in the future.
Dan Friedman mentioned a similar potential of using it in an
interactive theorem prover, so that we may know what part of the proof
term is changed.
I'm not expert of Git. I'll look more into that part later.
-- Yin