This repository was archived by the owner on Jan 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
No local var option #270
Draft
Stevendeo
wants to merge
2
commits into
MLanguage:dev
Choose a base branch
from
Stevendeo:no-local-var-option
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
No local var option #270
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
da8b397 to
d9a8170
Compare
Contributor
Author
|
Résultats des tests via
|
f5379f8 to
57fee26
Compare
cfbb9a3 to
778b1d3
Compare
778b1d3 to
4aead1a
Compare
4aead1a to
afc17df
Compare
Contributor
Author
|
@david-michel1 La PR a eté rebasée sur adaptation_correctif pour gagner du temps sur le merge, tu peux la review et la merger quand tu veux ! |
5e63c23 to
3e50465
Compare
Contributor
Author
|
J'ai rajouté quelques fix pour que les tests passent mieux - notamment, j'ai corrigé la représentation des binops au niveau compilateur pour limiter la quantité de parentheses, car dans l'état on dépassait les 256 parentheses (ce qui lève un gros flag au moment de la compilation). |
819d327 to
d47d498
Compare
Contributor
Author
|
Les commits suivants sont juste du nettoyage |
2ac96fa to
bcabe44
Compare
bcabe44 to
fd456ec
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new
--no-local-varoption that forces mlang not to define local vars when calculating expressions.Expressions were compiled as sets of simple binary operations of the form
inti = intj || int k;. While this is memory efficient, I believe having the whole expression could lead to some optimizations.C compilers can optimize code with smarter heuristics. For example, when checking the definition of a given variable, the current code calculates all the possible branches while some of them could be simplified quickly (if
DC_[A] = 1, thenDC_[A] || DC_[B] || DC_[C] || DC_[D]can be evaluated to1directly, whileint0 = DC_[A] || DC_[B]; int1 = int0 || DC_[C]; int0 = int1 || DC_[D];requires to calculate everything.)We could simplify boolean expressions with some basic boolean algebra.
Ideally, the
--no-local-varoption is meant to be temporary. Either the optimization makes the code more efficient and the option becomes the default behavior, or this PR will document why mlang behaves like this.