Lartu / ldpl

COBOL-like programming language that compiles to C++. With serious dinosaurs with neckties and briefcases 🦕💼
https://www.ldpl-lang.org/
Apache License 2.0
160 stars 24 forks source link

Make -i include order match what's passed #88

Closed xvxx closed 5 years ago

xvxx commented 5 years ago

Files passed to -i= on the command line are being compiled in the reverse order given, leading to (unexpected?) dependency issues.

For example:

$ cat a.ldpl 
DATA:
a is text

$ cat b.ldpl 
DATA:
b is text

PROCEDURE:
store "yay" in a

$ cat c.ldpl  
PROCEDURE:
display a crlf
display b crlf

$ ldpl -i=a.ldpl -i=b.ldpl c.ldpl 
LDPL Error: Malformed statement (b.ldpl:5)

This errors because b.ldpl is actually compiled first right now. With this patch, running the same code above preserves the compilation order:

$ ldpl -i=a.ldpl -i=b.ldpl c.ldpl 
LDPL: Compiling...
* File(s) compiled successfully.
* Saved as c-bin
$ ./c-bin
yay

I know we're going to rework -i in the future but I thought this might be worth changing now.

Lartu commented 5 years ago

Awesome! Thank you very much for fixing this!!