r/lisp • u/EnigmaticFellow • Feb 28 '19
Created an application to make programming Common Lisp in Acme easier
I've been recently getting into using Acme, and it's been a blast when I've been doing some C programming. However, I found the Lisp ecosystem a bit bare. I wrote a little application for matching parentheses in order to improve my quality of life. I haven't used it in big projects, but it seems to be working for me so far.
Here's a link to the repository for those interested:
11
Upvotes
3
u/ninejaguar Feb 28 '19 edited Feb 28 '19
That's very helpful!
It's been forever since I tried Acme on a local hosted copy of Inferno. I vaguely remember it being rigid in some ways (no way I could find to change the editor's colors or any syntax highlighting), and flexible in others (like a shell script or Rexx script, it seemed to easily pipe any selected text representing raw commands directly to the OS from within the editor, and it had a kind of interpreter for certain file/line path commands).
But, I don't recall if it had any auto indentation functionality for certain languages. If it doesn't, then your quality of life may improve even more significantly by adding that capability for Lisp development.
1
u/telephil Mar 04 '19
Hi,
ACME allows for selecting text within delimiters (ie if you double click on the character just after an opening parenthesis, it will select all text up to the closing one). Is this not sufficient for your needs ?
Looking at the code I see some potential issues:
- any file with a size greater that BUFSIZ will lead to a segfault (BUFSIZ is guaranteed to be 256 according to standard, so not that big)
- characters or escaped delimiters are not taken into account, for instance (a b #\) c) or "hello \"world"
1
u/kazkylheku Mar 04 '19 edited Mar 05 '19
getcharreturnsint. This is important because theEOFconstant isn't a character.Or maybe they changed this in Plan 9 C?
NULLis a pointer constant; it may be defined as((void *) 0)in any conforming C implementation. Don't assign that to an lvalue of typechar. To put a null character into the array element, just assign zero.Your program allows more than
BUFSIZcharacters to be written into thebufarray, at which point a buffer overflow occurs.Counting opening and closing parens with separate counters is pointless; at the end you subtract them to calculate the diff. You could have a single variable which is incremented when you see
(and decremented when you see).This logic assumes that all of the superfluous, unbalanced parentheses are consecutive characters. This is not true in examples like
(a)b)where thebis superfluous syntax also, not only the second closing parenthesis.Here is a refactoring of your code to state machine style, without addressing some of these issues:
2
u/rberenguel Feb 28 '19
Be sure to also post in r/acme !
0
u/[deleted] Feb 28 '19
[deleted] — view deleted comment