EoinDavey / Setanta

Setanta - Teanga Ríomhchlárúcháin as Gaeilge - Irish Programming Language
Mozilla Public License 2.0
93 stars 4 forks source link

Deisigh scóipeáil léacsach | Fix lexical scoping #10

Closed EoinDavey closed 4 years ago

EoinDavey commented 4 years ago

Níl an scóipeáil léacsach ag obair go ceart. Scríobhann an ríomhchlár seo 2

x := 0
gníomh a() {
    gníomh b() {
        toradh x
    }
    x := 2
    toradh b
}

scríobh(a()())

Is é 0 an freagra ceart. Caithfímid "resolver pass" a dhéanamh sula dtosaítear an ríomhchlár


The lexical scoping is not working correctly. This program prints 2

x := 0
gníomh a() {
    gníomh b() {
        toradh x
    }
    x := 2
    toradh b
}

scríobh(a()())

0 is the correct answer. We have to do a resolver pass before the program is started.

EoinDavey commented 4 years ago

Tosaíodh an obair ar brainse 10-binding