Author: Tord Romstad
Date: 08:30:16 02/17/04
Go up one level in this thread
On February 17, 2004 at 08:50:16, Sune Fischer wrote: > >>What I tried to say was that if I wanted to write an assembly language >>chess program, I would have written it in Lisp, making extensive use of >>Lisp macros. Essentially I would build a simple special-purpose low-level >>chess programming language with a Lispish syntax, and use macros to >>transform this to assembly language. Much easier and more comfortable >>than writing directly in assembly language, but with very little loss >>of performance. > >So before you get started you must create a "special-purpose low-level >chess programming language with a Lispish syntax"? :) > >I could be wrong, but inventing a language to solve a problem seems like a big >project in itself. It might seem so, but it is no big exaggeration to say that Lisp is designed for this very purpose, and most big Lisp programs use precisely this approach. Lisp is used to build a language tailor-made for the problem domain, and the final program is written in this language. Most often, this language is compiled to Common Lisp (which, in its turn, is compiled to native machine code), but it is also possible to compile to assembly language instead if this is preferable. You are of course right that inventing a new language is not worth the effort unless the problem at hand is very big. But in the case of a chess program, assuming that you are a reasonably good assembly language programmer, there is no reason to build anything more than a very thin layer on top of assembly language. You can choose to regard your Lisp as nothing but an assembler with an extremely powerful and flexible macro system. When you have built a few chess-specific macros, you have essentially created a tiny low-level chess programming language. Such an approach to chess programming would probably require considerably more work than writing it all in C, but less work than writing it all in assembly language. The performance should be comparable to an assembly language program. Perhaps I will even consider using an approach like this when porting my engine to Palm OS, but first I will have to study ARM assembly language to see how difficult it looks. >>For an iteresting example of this type of approach, look at the following >>article describing Naughty Dog Software's use of Lisp to create a language >>called GOAL ("Game Oriented Assembly Lisp"), which they use to develop >>video games for the Sony Playstation. This is of course different from >>chess programming, but it is still an example of programs with very high >>performance requirements: >> >>http://www.franz.com/success/customer_apps/animation_graphics/naughtydog.lhtml > >In the end it's mostly up to the compiler to make it run fast or not. > >If it is possible to be as 'explicit' in Lisp as in C, then I see nothing >preventing a Lisp compiler from being as good as a C compiler, other than >perhaps more money goes into developing C compilers. Most implementations allow you to be as explicit (or at least close) as in C, but a problem is that there is no portable way to do so. >On the other hand if Lisp allows the programmer to express himself in a more >'fuzzy' manner, as I would expect of a high-level language, then I think Lisp >will have a theoretical disadvantage. > >>The point is that high-level languages are sometimes the perfect tools >>for writing low-level programs. :-) > >I find that hard to believe. >I think there is a reason why people still use C and assembly today, and I doubt >it's because they are all ignorant to the powers of Lisp ;-) But there are already people who use Lisp this way, as you can see in the example of Naughty Dog Software above. The interest for this kind of techniques also seem to be increasing in the Lisp community, and I expect to see more of it in the future. A COAL ("Chess-Oriented Assembly Lisp") language would be a cool project; I hope to find the time to do it some day (but unfortunately the list of projects I hope to do is growing so long that I will never be able to even start on moth of them. It would probably have to be platform-specific, though. If I ever do it, it will almost certainly be for the ARM or PowerPC architecture. Tord
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.