dbaumgarten / yodk

Development Kit for Starbase's ingame programming language YOLOL
MIT License
57 stars 16 forks source link

Infinite compiling? #93

Closed vabka closed 2 years ago

vabka commented 2 years ago

Describe the bug I am trying to compile a .nolol file but compiling process doesnt finish.

To Reproduce

  1. Create file test.nolol in current directory with content
    
    define :x=:X
    define :y=:Y
    define :z=:Z

x=:x; y=:y; z=:z


2. Run command `yodk compile ./test.nolol`
3. Wait till heat death of the universe?

**Expected behavior**
Code successfully compiled

**Platform:**
 - OS: Windows 11 and WSLv2
 - yodk: v0.1.6

**Additional context**
Looks like infinite loop somewhere
![image](https://user-images.githubusercontent.com/17644379/130543292-01b2a6cb-139c-4ece-813c-f5a5a269707c.png)
dbaumgarten commented 2 years ago

Without having tested it, I suspect this is caused by define :x=:x. The compiler replaces all occurrences of :x with, :x, which results in new :x to replace leading to an infinite loop . Try changing your definitions to not produce an endless loop. However, I agree that the compiler should detect such a situation and should throw a helpfull error.

vabka commented 2 years ago

Just forgot that language is case insensetive 😓

dbaumgarten commented 2 years ago

Well, to quote the Nolol-Documentation: quote 😁

dbaumgarten commented 2 years ago

Published with v0.1.9.