GNU   davin.50webs.com/research
Bringing to you notes for the ages

       Main Menu          Research Projects         Photo Album            Curriculum Vitae      The Greatest Artists
    Email Address       Computer Games          Web Design          Java Training Wheels      The Fly (A Story)   
  Political Activism   Scruff the Cat       My Life Story          Smoking Cessation          Other Links      
Debugging Macros     String Class I     Linked List System I Java for C Programmers Naming Convention
    String Class II         How I use m4              Strings III                 Symmetrical I/O             Linked Lists II     
Run-Time Type Info   Virtual Methods      An Array System        Science & Religion            Submodes       
  Nested Packages      Memory Leaks    Garbage Collection      Internet & Poverty      What is Knowledge?
Limits of Evolution   Emacs Additions      Function Plotter           Romantic Love        The Next Big Thing
    Science Fiction     Faster Compilation Theory of Morality         Elisp Scoping               Elisp Advice      
  S.O.G.M. Pattern       Safe Properties         School Bullying          Charisma Control          Life and Death    
     Splitting Java          Multiple Ctors       Religious Beliefs         Conversation 1           Conversation 2    
   J.T.W. Language    Emacs Additions II      Build Counter             Relation Plotter          Lisp++ Language  
  Memory Leaks II   Super Constructors CRUD Implementation Order a Website Form There Is An Afterlife
More Occam's Razor C to Java Translator Theory of Morality II


A new programming language called Lisp++ Free Stuff

Abstract

While spending seven months writing a computer game called R4: Rocketman in C++ I ran into some problems with the C++ language. From the lessons learnt from writing this large (approximately 25,000 lines of code) program I have worked out how to eliminate these problems with the C++ language by merging the best of C++ with the best of Lisp to produce a new language which I will call The Lisp++ Programming Language (at the risk of confusion with an unrelated software package called Lisp++) that as its name suggests combines the expressiveness of Lisp with the efficiency of C++. You can view the cover jacket of my book by clicking on the image on the right of this paragraph. You can view the actual book by clicking here.


1. Problems with C++

  • It is problematic how when the source code has more than one class, not all methods can be have their method bodies defined within the class that they belong to. Lisp++ emulates Java in this respect so that every method can be put directly inside a class. Here is an example of some code that won't compile under C++, but whose counterpart will compile under Java:

Cover Page

2. How Lisp++ works

Lisp++ code resembles Lisp code. In Lisp++, the Emacs editor is used as a Lisp interpreter which compiles Lisp++ code into C++ code. Then the G++ compiler is used to compile C++ code into machine language code. The basis of the Lisp interpreter is a new Lisp function which I will call lisp++2c++ compiles every file in the directory variable *directory*. Here is an example of some Lisp++ code:


(cfunction (cret void) (cname my_function) (cargs)
 (s int x = 0;)
 (s foo(f (123 * 456) hello);)
 (s bar(f 123 (456 + 789) abc);)
 (cif (abc)
     (s dmp::cout << "abc\n";)
  celseif (def)
     (s dmp::cout << "def\n";)
  celseif (ghi)
     (s dmp::cout << "ghi\n";)
  celse
     (s dmp::cout << "jkl\n";))
  (cfor ((s int i=0;) (s i<10;) (s i++))
     (s dmp::cout << i << "\n";)))
which compiles to the following C++ code:

void my_function()
{
   int x = 0;
   foo((123 * 456),hello);
   bar(123,(456 + 789),abc);
   if (abc)
   {
      dmp::cout << "abc\n";
   }
   else if (def)
   {
      dmp::cout << "def\n";
   }
   else if (ghi)
   {
      dmp::cout << "ghi\n";
   }
   else
   {
      dmp::cout << "jkl\n";
   }
   for (int i=0; i<10; i++)
   {
      dmp::cout << i << '\n';
   }
}
You can download the source code to c++2lisp++ and lisp++2c++.
Back to Research Projects
This page has the following hit count:
| Main Menu | Research Projects | Photo Album | Curriculum Vitae | The Greatest Artists |
| Email Address | Computer Games | Web Design | Java Training Wheels | The Fly (A Story) |
| Political Activism | Scruff the Cat | My Life Story | Smoking Cessation | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked Lists II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter | Romantic Love | The Next Big Thing |
| Science Fiction | Faster Compilation | Theory of Morality | Elisp Scoping | Elisp Advice |
| S.O.G.M. Pattern | Safe Properties | School Bullying | Charisma Control | Life and Death |
| Splitting Java | Multiple Ctors | Religious Beliefs | Conversation 1 | Conversation 2 |
| J.T.W. Language | Emacs Additions II | Build Counter | Relation Plotter | Lisp++ Language |
| Memory Leaks II | Super Constructors | CRUD Implementation | Order a Website Form | There Is An Afterlife |
| More Occam's Razor | C to Java Translator | Theory of Morality II
Last modified: Wed Sep 6 01:14:28 NZST 2017
Best viewed at 800x600 or above resolution.
© Copyright 1999-2017 Davin Pearson.
Please report any broken links to