This is amazing. Just reading the code makes my head hurt, but you implemented a language with it.
Here, for example, is the implementation of `atom` (I think): /(atom /{ /\[\S\+\]/{ s/.*/[]/ bpop_context } s/.*/t/ bpop_context }
Lisp implementation in sed
31–40 of 64 posts
Re: Lisp implementation in sed
#32Earlier quoted context omitted.
Oh come on. They took an unreadable language and implemented a slightly less unreadable language in it. That's at least two problems and one solution. To what, I don't know.
Having a Lisp will make it a little easier to write the Javascript interpreter. Baby steps.
Re: Lisp implementation in sed
#33Earlier quoted context omitted.
You didn't misinterpret.
i am not particularly gifted at computer science and especially not programming languages. by necessity, the only languages i know are JavaScript and lisp. so I am always surprised to hear lisp is "unreadable" as opposed to "unfamiliar".
Re: Lisp implementation in sed
#34Earlier quoted context omitted.
i am not particularly gifted at computer science and especially not programming languages. by necessity, the only languages i know are JavaScript and lisp. so I am always surprised to hear lisp is "unreadable" as opposed to "unfamiliar".
I appreciate the fact that one reply to your comment it "yes, not enough macros", and the other is "indeed, too many macros".
Re: Lisp implementation in sed
#35Would someone mind giving a quick explanation of how this works? I have only used sed to replace text in files and directories. How do people write interpreters and game loops with this unix utility?
Re: Lisp implementation in sed
#36Earlier quoted context omitted.
i am not particularly gifted at computer science and especially not programming languages. by necessity, the only languages i know are JavaScript and lisp. so I am always surprised to hear lisp is "unreadable" as opposed to "unfamiliar".
I think that Lisp got a reputation for being unreadable because some Lisp programmers have the tendency to get too far into macros to extend the language, resulting in a language that other developers have not seen before.
Re: Lisp implementation in sed
#37Earlier quoted context omitted.
Yep, that's pretty much how you have to do it. (If all you need is increment/decrement, though, you can actually do it pretty concisely with decimal-digit strings. Skipping the binary-to-decimal conversion greatly simplifies displaying numerical values.)
The GNU sed manual has examples like that at the end. It always seemed odd to show examples of things that are so awkward and inefficient. If they meant for sed to do those things, presumably they would have made commands for them.
Re: Lisp implementation in sed
#38Ahahah. Awesome. There is even an 'awk' version: https://github.com/darius/awklisp
I wrote that, and I gotta say sed is a much crazier target. More sed fun: http://aurelio.net/projects/sedsokoban/
Re: Lisp implementation in sed
#39Earlier quoted context omitted.
i am not particularly gifted at computer science and especially not programming languages. by necessity, the only languages i know are JavaScript and lisp. so I am always surprised to hear lisp is "unreadable" as opposed to "unfamiliar".
I think that Lisp got a reputation for being unreadable because some Lisp programmers have the tendency to get too far into macros to extend the language, resulting in a language that other developers have not seen before.
Re: Lisp implementation in sed
#40Earlier quoted context omitted.
The GNU sed manual has examples like that at the end. It always seemed odd to show examples of things that are so awkward and inefficient. If they meant for sed to do those things, presumably they would have made commands for them.
> to show examples of things that are so awk ward and inefficient