chsasank / llama.lisp

Lisp dialect designed for HPC and AI
GNU Lesser General Public License v2.1
14 stars 6 forks source link

Prelisp cannot handle empty lists #93

Open GlowingScrewdriver opened 1 month ago

GlowingScrewdriver commented 1 month ago

Prelisp recursively tests the first element of each list to determine whether it is an unquote or unquote-splicing expression. This test causes an IndexError when an empty list is being processed. Consider the following macro call:

,@(array-init arr () 5)

Prelisp will run into an error while analyzing the second argument to the macro:

  File "/home/gsd-vnai/Desktop/llama.lisp/src/backend/tests/prelisp/../../prelisp.py", line 17, in preprocess
    if expr[0] == "unquote":
       ~~~~^^^
IndexError: list index out of range
GlowingScrewdriver commented 1 month ago

May be fixed by #91

chsasank commented 2 weeks ago

Create a PR with regression test