[M3devel] m3front scanner div wierdness?

Jay K jay.krell at cornell.edu
Wed Jun 29 05:54:15 CEST 2016


Does anyone understand this stuff in m3front/Scanner.m3:

 Here vs. LocalHere?
 SameFile?

 
 I understand only this nuance:
  offset MOD MaxLines
  
  MaxLines  = 100000;


 is to crudely handle that when asserts fail,
 they pack the line number in with the assertion failure code,
 potentially loosing bits.

 
 I don't think this is a good design, they should just be separate INTEGERS,
 but this is besides the point.

 
 What doesn't makes sense to me is the machinations around file name.


Here: 
    file := files [offset DIV MaxLines];

vs. LocalHere:
    file := local_files [fnum];


LocalHere makes sense. Here does not.


PROCEDURE SameFile (a, b: INTEGER): BOOLEAN =
  BEGIN
    RETURN (a DIV MaxLines) = (b DIV MaxLines);
  END SameFile;



Shouldn't this just be a = b?


Well, anyway, this SameFile function isn't called.

Here and LocalHere are used.


I'm looking here because I want to add a temporary measure
such that the file names are leaf-only.


In particular, because generic modules have target names in their paths
and I want to temporarly remove target names from output, so I can prove
that a few targets are identical.


I guess, really, I propose the interface to assertion failures be expanded to take the line number separate from the failure code.
This has to percolate quite a bit through the system -- the backends and the runtime.


And then this Here vs. LocalHere difference should fall away.
But still, what is it trying to do?


Thank you,
 - Jay


 		 	   		  


More information about the M3devel mailing list