tsoding / bm

Simple compiler ecosystem
MIT License
169 stars 16 forks source link

`Basm` struct does not store the location or names of labels #416

Closed zhiayang closed 3 years ago

zhiayang commented 3 years ago

while actually generating debug info is a whole 'nother story, the least we could do is to generate nasm labels that have the same name as the basm labels, so that we can use them as breakpoints, and/or see them in stacktraces (I suspect this will be useful for bang functions as well).

however, the labels and their locations are not captured in the basm struct.

rexim commented 3 years ago

Quick note, basm also has the notion of the scopes which enables this kinda stuff:

%scope
   ; ...
   %scope
      ;...
      foo:
      ;...
   %end
   %scope
      ;...
      foo:
      ;...
   %end
%end

Here we have two labels foo that reside in neighboring scopes and don't conflict with each other. I suppose we could capture only the ones that are in the global scope.