← Back to context

Comment by eimrine

5 years ago

Sorry for incorrectness, I want to look at interpreter of any dialect of Lisp language, written in J, if the one exists. I found J's approach to syntax interesting to explore.

Here you are:

https://code.jsoftware.com/wiki/Scripts/Scheme

http://tangentstorm.github.io/apljk/bjonas-scheme.ijs.html

However, in my understanding this code is clear but is just an exercise to use J. A real Scheme parser in J would go through the use of ;: which is a primitive defining a state machine. Given the appropriate state table, it would yield a Scheme tokenizer (with the whole thing amounting to state_table ;: string). Here be dragons, though! You can find a J parser in J (not up to date with current J) using it here:

https://www.jsoftware.com/help/dictionary/d332.htm

Writing a lisp interpreter in J won't really do more to help explore J's syntax than writing anything else in J. It might be a good way to explore how J handles tree-like data, but that's not really something J is designed to do well (if you really want to use an array-oriented language for tree processing, Aaron Hsu's dissertation covers a range of techniques that are more scalable than the naïve nest-of-short-boxed-vectors approach typically used in J).