I am playing with LFE language and I try to improve documentation lookup. Some of my efforts can be seen on my Github repo

I have a function sexp-at-point which return a string enclosed by round brackets. That function is used by helpme function, which reads the string converting it to an Elisp list. That in turn, is processed to look up the documentation. The problem is that read sometimes fails on valid LFE syntax. so far I found it fails on vectors

 #(1 2 3)

Is there a better way to parse usually short strings into lists. In LFE number of arguments is important and I try to make documentation lookup reflect arity as well. Also, an LFE function can have different forms.

(model:function arg1) (: model function arg1) (function arg1)

So using something similar to read is the best option in my humble opinion. Please correct me if I am wrong. If you agree with my approach please suggest how I could improve it. Is there a parsing library that I could use?

  • Would sanitising the string before I read it be a good approach? After all, I only need to count the arguments and do not care if they are vectors? Dec 30 '16 at 0:34
  • Without looking at your code, recursive descent is the standard approach to parsing in Lisps: en.wikipedia.org/wiki/Recursive_descent_parser You might also check out the smartparens package: github.com/Fuco1/smartparens It might not be too difficult to add support for LFE
    – Qudit
    Dec 30 '16 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.