KeliLanguage / compiler

The compiler for Keli
https://keli-language.gitbook.io/doc/specification/
Apache License 2.0
171 stars 1 forks source link

Transpilation error when symbols declared in this file clashes with imported symbols #33

Closed wongjiahau closed 5 years ago

wongjiahau commented 5 years ago

This shouldn't happen based on spec (https://keli-language.gitbook.io/doc/specification/section-6-modules#6-6-4-conflicts-between-importees).

wongjiahau commented 5 years ago

How to implement?

First, we need to keep track of the reference count of all symbols, if the symbol have refcount of 0, then don't transpile it. Thus this problem will not arise.

wongjiahau commented 5 years ago

Related to #29

wongjiahau commented 5 years ago

How to implement?

First, we need to keep track of the reference count of all symbols, if the symbol have refcount of 0, then don't transpile it. Thus this problem will not arise.

This won't work, the following is an counterexample:

// a.keli
x = 5
y = x + 5
// b.keli
x = 6
// c.keli
= module.import("a.keli")
= module.import("b.keli")
= y