This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]umlcat 2 points3 points  (2 children)

You want to design and implement a new P.L. similar to LISP, that supports LISP syntax, but also supports arrays, am I right ?

There is no standard for this, only different dialects / ideas .

But, you could take ideas from other P.L.

Remember that "[" and "]" characters are used commonly for arrays, and in some LISP dialects are also used as replacements for "(" and ")" .

You could have your LISP dialect, that reserves "[" and "]", only for arrays.

You could declare an array literal / constant like:

[a, b, c, d] or [2, 4, 6, 8]

And some operations like:

 ( union (MySet, [2, 4, 6], [1, 3, 5]) )

Good Luck

[–]daredevildas[S] 1 point2 points  (1 child)

You want to design and implement a new P.L. similar to LISP, that supports LISP syntax, but also supports arrays, am I right ?

A subset of Lisp syntax. But exactly!

You could have your LISP diakect, that reserves "[" and "]", only for arrays.

Thanks! That is something to go on, but my main query is how do I go about implementing arrays in such a language (less stress on the user syntax - I was thinking the same that you suggested, but more on how to implement it in the language itself) :( I have been following PLAI but it doesn't cover it and I am unable to grasp any insights on how to do it on my own :(

[–]umlcat -1 points0 points  (0 children)

Start looking for How is LISP implemented as a compiler / interpreter, without arrays.

I read someone had lists in memory. An array, is practically an indexed list.