Semantic difference of source files

This is a discussion on Semantic difference of source files within the Compilers forums in Theory and Concepts category; Hi Michiel, >I propose that in addition to comparing modification dates, we selectively >compare AST's (if the source file is newer). At the very least this allows >the programmer to modify style, layout and comments without requiring any >recompilation at all. If the comparison utility is smart enough, you may >even perform trivial refactoring without losing semantic equivalence. As per your thought programmer can make cosmetic changes like changing the comments / spaces / tabs / new lines, any such cosmetic change will not lead to re-compilation. How are you going to keep the line number info updated ? It ...

Go Back   Application Development Forum > Theory and Concepts > Compilers

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 08-28-2008, 03:35 AM
Jatin Bhateja
Guest
 
Default Re: Semantic difference of source files


Hi Michiel,

>I propose that in addition to comparing modification dates, we selectively
>compare AST's (if the source file is newer). At the very least this allows
>the programmer to modify style, layout and comments without requiring any
>recompilation at all. If the comparison utility is smart enough, you may
>even perform trivial refactoring without losing semantic equivalence.


As per your thought programmer can make cosmetic changes like changing
the comments / spaces / tabs / new lines,
any such cosmetic change will not lead to re-compilation. How are you
going to keep the line number info updated ?
It needed by source debugger to refer to correct source line analogous
to current assembly/machine instruction .

--
Thanks and Regards
Jatin Bhateja

Reply With Quote
  #12  
Old 08-28-2008, 11:49 AM
m.helvensteijn@gmail.com
Guest
 
Default Re: Semantic difference of source files

On Aug 28, 9:35 am, Jatin Bhateja <Jatin_Bhat...@mentor.com> wrote:

> >I propose that in addition to comparing modification dates, we

selectively
> >compare AST's (if the source file is newer). At the very least this

allows
> >the programmer to modify style, layout and comments without requiring any
> >recompilation at all. If the comparison utility is smart enough, you may
> >even perform trivial refactoring without losing semantic equivalence.

>
> As per your thought programmer can make cosmetic changes like changing
> the comments / spaces / tabs / new lines,
> any such cosmetic change will not lead to re-compilation. How are you
> going to keep the line number info updated ?
> It needed by source debugger to refer to correct source line analogous
> to current assembly/machine instruction .


Good question. It's something I did not initially consider. Of course,
when compiling in release mode, this is not a problem. But I agree
this is unacceptable, since it's exactly in debug mode where you want
the compilation to be fast.

I'm not sure how line-numbers and such are usually stored in a binary
file. However, I imagine it would be possible to store that
information in a separate section of the binary, clearly marked with a
unique bit-sequence. Then it is only that section of the binary that
would need to be updated by the compiler. This also requires nothing
more than the AST. The rest of the binary would be copied bit by bit.

I imagine something like that would probably break binary
compatibility for existing compilers. I can't say much about this with
my limited experience. But it may be a sacrifice worth making.

--
Michiel Helvensteijn
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:29 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.