epatrizio / comp2mzam

Imperative language compiler to the Mini-ZAM
The Unlicense
0 stars 0 forks source link

Refactoring localization error #9

Open epatrizio opened 2 years ago

epatrizio commented 2 years ago

Localization error (typer / compiler) implementation is not optimal, not elegant! To avoid having long type constructors with systematic localization attribute in expressions and statements, it would probably be better to factorize ("decorate") expr and stmt types.

For example, in AST :

type ident = { id: string; id_loc: loc }

type expr = {
  expr_node: expr_node;
  expr_loc: loc;
}

type stmt = {
  stmt_node: stmt_node;
  stmt_loc: loc;
}

This refactoring seems interesting ;)

epatrizio commented 2 years ago

previous associated PR #8