Hasty Briefsbeta

Bilingual

Pseudo, a Common Lisp macro for pseudocode expressions

9 months ago
  • #Macro
  • #Common Lisp
  • #LLM
  • The `pseudo` macro allows embedding pseudocode expressions in Common Lisp, which an LLM expands into s-expressions.
  • It gathers contextual info like lexically visible variables, fbound/bound symbols, and directives for code generation style.
  • Lisp's macro system is advantageous due to s-expression representation, avoiding parser/compiler interfacing.
  • Caveats include LLM slowness, unpredictability, incorrect code, and unsuitability for production.
  • Dependencies include SBCL for extracting lexically visible variables and libraries like `alexandria`, `cl-json`, etc.
  • Developed using Google's Gemini but adaptable to other LLMs; requires a Google API key.
  • Similar concepts explored in Julia, highlighting Lisp-family languages' advantages for such integrations.
  • LLM performs better with limited scope; avoids expanding into definitions starting with 'def'.
  • Potential expansion to class definitions considered but deemed redundant if users provide slot names.