I have a Lisp file with some functions defined [ (defun ... ].
Is there an easy way to get all function names defined in the script using Java?
If you want to know, which functions are defined in a certain package, you cane use with-package-iterator macro. Like this:
(with-package-iterator (next (find-package 'test) :internal)
(loop :for (more? sym) := (multiple-value-list (next))
:if (fboundp sym) :collect sym :into rez
:else :unless more? :do (return rez)))
If you want to just extract functions from a script(-file), the easiest way seems to be scanning it with a regex "\\(defun (.+)\\s" or something similar.
In very simple cases, you can use regular expressions. In slightly less simple cases, implementing an S-expression reader might be a reasonable approach (you might even get away with ignoring reader macros altogether). In the general case, though, especially if macrology is involved, consider embedding Armed Bear Common Lisp, which is a Java implementation of Common Lisp, and using the with-package-iterator form Vsevolod mentioned.