Skip to content

FlatExpression: explore canonical representation pros and cons #531

@dadhi

Description

@dadhi

Canonical means that equivalent (up to Parameter names and Constant values) FE nodes should be in the same order in ExpressionTree and so trivially comparable via loop. See #530.
Explore does this representation actually helps in

  • FEC collect phase - besides the slready collected closure constants - what about nested lambdas, blocks, label and gotos, etc. being collected by CompilerContext in TryCollectInfo methods
  • In emit phase, e.g. to trivially emit arithmetic expressions on stack from the natural stack order in FE.
  • in other regards - look at tasks solved by FEC now and next tasks: full fledged interpreter and C# parser (and potentially for other langs)

Explore and implement IsInOrder and PutInOrder methods.
Ordering should be done inplace modifying this ExpressionTree.
It may be implemented by doing a min amount of nodes swap.

While doing InOrder we may also:

  • drop/consider empty unrichable nodes, the check may retutn thr numbet of such nodes
  • we need to compact gaps created by empty nodes to ensure the indexes are the same
  • do other checks eg, for labels

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions