IDMclean Posted November 15, 2006 Report Posted November 15, 2006 Are there any computer languages that have primitives, or objects which contain not a value, or address, but a expression of the written language itself? Perhaps I am just having difficulty conceiving of the mechanism of doing this with languages I use. Quote
pgrmdave Posted November 15, 2006 Report Posted November 15, 2006 I don't know of any, but look into LISP, and read Godel Escher Bach and/or Metamagical Themus by Douglas Hofstader - if you want to learn about self-reference, whether in mathematics, computers, or language, those two books will provide excellent resources. Quote
IDMclean Posted November 15, 2006 Author Report Posted November 15, 2006 Actually, I thought of this in reference to GEB, which I am in the process of reading. I had been thinking of self-referential languages for the longest time. I just recently have been working on the capability to express my thoughts in this field. pgrmdave 1 Quote
TheFaithfulStone Posted November 15, 2006 Report Posted November 15, 2006 My all time favorite example of self-reference. Good url. Will be posted again later. TFS pgrmdave 1 Quote
CraigD Posted November 15, 2006 Report Posted November 15, 2006 Are there any computer languages that have primitives, or objects which contain not a value, or address, but a expression of the written language itself?Some languages – especially interpreted (as opposed to compiled) one lend themselves better to what I thing you’re describing. Though LISP is usually mentioned as a language that lends itself to containing expressions of itself, I’m fond of MUMPS (as anyone who’s noted the programs I’ve posted at hypography is likely aware ;) ), which also lends itself to manipulating its own code. Here’s a very simple example, cut from a MUMPS direct (interactive) mode terminal session (note the “USER>” is a typical direct mode prompt, not actual input or program output):USER>r X w 1 q:'5 s $p(X," ",3)="q:'"_($p(X,"'",2)-1) x X w 2 USER>x X 11111122222 USER>w X w 1 q:'0 s $p(X," ",3)="q:'"_($p(X,"'",2)-1) x X w 2 USER>This program counts down from 5 to 0. It’s not a particularly good or clever program, but remarkable in that the code contained in symbol X references no symbol but itself. Note that MUMPS keywords can be and usually are abbreviated (eg: r[ead] w[rite] q[uit] s[et] $p[iece] x[ecute]), leading many to comment that it looks like line noise. :cup: It’s fairly easy to write much more complicated and meaningful self modifying MUMPS programs, such as in the puzzle game-playing program in my post ”Self modifying code in an interpreted language”. Quote
moo Posted November 15, 2006 Report Posted November 15, 2006 One way of doing this (in any language) is have your app write a simple "pseudo" language to a file, then code a simple interpreter to read it. I played around with something like this a few years ago for experimenting with self modifying AI programs. You could use RAM, but a file holds the data for review even if the app crashes. :cup: moo Quote
TheFaithfulStone Posted November 15, 2006 Report Posted November 15, 2006 So Clown, I found this on Wikipedia, are you talking about a quine? TFS Quote
alexander Posted November 16, 2006 Report Posted November 16, 2006 you can do it with PHP man. Check out the eval function :shade: Quote
IDMclean Posted April 23, 2009 Author Report Posted April 23, 2009 I recently learned reflection and generics and Java, and it revitalized my interest in the subject of a self-referential language. I've been working the past week on designing the basic structure of a fully object-oriented programmable programming language for writing programming languages. Recently, I became cognizant of my disgruntlement with so called object-oriented languages like Java. Java has no object representing the language itself or representing languages in general with which you can operate upon. What is a strangeloop program/programming-language which produces genetic variants of itself as it's output? A quine is a strangeloop which produces a clone. Quote
TheFaithfulStone Posted April 23, 2009 Report Posted April 23, 2009 Seems like Smalltalk might be your thing. Squeak for instance contains a version of itself written in itself. Plus, you can do foolish things like true := false. Fun. tfs Quote
Buffy Posted April 23, 2009 Report Posted April 23, 2009 Smalltalk is not a bad recommendation, except for the fact that you don't have much support around it in terms of compiler/interpreters and tools. A better one--indeed probably the canonical one--is LISP: it operates on lists and every program is a list and it has oodles of tools to redefine itself. Although there are compilers (Franz Lisp), the notion of compiling a LISP program is a bit of an oxymoron... Best thing is you've got 40 years worth of LISP stuff out there to build on, since its probably by far the most popular language for AI apps. LISP programmers know the value of everything and the cost of nothing, :lol:Buffy Quote
IDMclean Posted April 23, 2009 Author Report Posted April 23, 2009 Smalltalk and Lisp are high on my list of programmable programming languages to investigate, but I suspect I have some fairly radical ideas regarding the design and implementation of a language of languages. Chief amongst the radical ideas would be the explicit purpose of the language: to develop languages. Most programming languages are designed and developed towards developing programs and solving specific problem domains like graphics or mathematics. This language would be oriented towards resolving the challenges of language. To give a more explicit account of what I am working on here are some properties that I am looking to design into a language:CompiledInterpretedProfiledSelf-Checking, Self-TestingFully Object-Oriented RecursionGenerics/TemplatedReflectiveDistributed/DistributableMulti-threaded orientationUtilizes quantum mechanics with an emphasis on Information TheoryUtilizes strangeloop genetic programmingRewriting I plan on using something like XML as the standard declarative portion of the language, so all objects in the language can and do exist in multiple forms: map, territory, and contextual overlays. Following the principle of least power. I'm performing tests towards this end by implementing some of my ideas in Java. Quote
alexander Posted April 23, 2009 Report Posted April 23, 2009 KAC, i'm with you on Lisp, though i think i would do Haskell over Smalltalk; Haskell has had it's day view in human behavioral simulation recently that came out in a game, that came out to be so cool it was and is still being studied by researchers at various universities. As i think behavioral simulation is something you are interested in (from what i think i know about you) that may be a language worth learning and putting higher up then Smalltalk, though i think you should battle with Lisp first :phones: Quote
IDMclean Posted April 23, 2009 Author Report Posted April 23, 2009 KAC, i'm with you on Lisp, though i think i would do Haskell over Smalltalk; Haskell has had it's day view in human behavioral simulation recently that came out in a game, that came out to be so cool it was and is still being studied by researchers at various universities. As i think behavioral simulation is something you are interested in (from what i think i know about you) that may be a language worth learning and putting higher up then Smalltalk, though i think you should battle with Lisp first :phones: I'm mainly interested in Lisp because of articles I've been reading and recommendations I've gotten from various expert individuals. The article I've linked proposes a principle of the most powerful language. My issue in learning new languages so far has been documentation. I'm spoiled due to my experience with Java which has clearly accessible universal documentation available online or in line with certain IDEs. If I could get similar documentation for Lisp, Haskell, or Smalltalk, I am sure I could pick up the languages rather quickly. Thanks for the suggestions,Curiouser and Curiouser The Clown. Quote
Pyrotex Posted April 23, 2009 Report Posted April 23, 2009 Reminds me of something that happened long ago at Texas Instruments. My co-workers and I programmed in straight assembler. But we wanted a higher level language to play with, hoping it would make us more productive. We all tried our hand at it, but our lead programmer came up with something novel -- he took the breakdown structure (BDS) of an existing language -- a very simple one -- and wrote a small assembly program that read in the BDS as input -- and then it would read in any program written in that higher level language, and reduce it to assembler. I don't know what they call a BDS nowdays, but it looked something like this:STATEMENT :== {ARITH_STATEMENT|IF_STATEMENT|LOOP_STATEMENT|begin|stop}ARITH_STATEMENT :== {[sIGN] TOKEN OP ARITH_STR|ARITH_STR}TOKEN :== {VARIABLE|INTEGER|REAL}OP :== {+|-|*|/}ARITH_STR :== {(ARITH_STR)|TOKEN|TOKEN OP TOKEN}...and so forth. Words in all upper caps are part of the BDS definition of the hi-level language. Actual key words in the hi-level language are lower case, like "begin", "stop", "call", "if" and so forth. The vertical bar, |, is read as "or". So, OP could be "+" or "-" or "*" or "/". We got to playing with this, writing little routines in our new hi-level language (HLL) until somebody realized that the BDS text was in a buffer in the computer while executing the HLL. It was trivial then to make a small adjustment in the BDS. If I remember correctly, we modified this line: TOKEN :== {VARIABLE|INTEGER|REAL|LANG} A "LANG" as we called it, could be any line in the BDS definition! Now, in our HLL, we could write statements such as: BDS(7) = "OP :== {+|-|*|/|^}"so that OP :== {+|-|*|/}becameOP :== {+|-|*|/|^} We just added a new operator, ^ !!!! This meant that in mid-program, we could change the rules of the language and use the new rules immediately.Eventually, we got it so we could add or delete options from any given line of BSD without having to redefine the whole line. We did this by defining a few new lines of BSD which gave us operators for selecting a specific option within an existing BSD line, and for searching the BSD line by line, option by option. We had a LOT of fun doing this, but it didn't come to much. We didn't have the time to spend all day experimenting with it, and producing something that wouldn't crash the whole computer was a really big challenge. But the possibilities... :P :phones: :hihi: Quote
IDMclean Posted April 23, 2009 Author Report Posted April 23, 2009 Reminds me of something that happened long ago at Texas Instruments. [...] Our lead programmer came up with something novel -- he took the breakdown structure (BDS) of an existing language -- a very simple one -- and wrote a small assembly program that read in the BDS as input -- and then it would read in any program written in that higher level language, and reduce it to assembler. [...] We got to playing with this, writing little routines in our new hi-level language (HLL) until somebody realized that the BDS text was in a buffer in the computer while executing the HLL. It was trivial then to make a small adjustment in the BDS. [...] This meant that in mid-program, we could change the rules of the language and use the new rules immediately.Eventually, we got it so we could add or delete options from any given line of BSD without having to redefine the whole line. We did this by defining a few new lines of BSD which gave us operators for selecting a specific option within an existing BSD line, and for searching the BSD line by line, option by option. We had a LOT of fun doing this, but it didn't come to much. We didn't have the time to spend all day experimenting with it, and producing something that wouldn't crash the whole computer was a really big challenge. But the possibilities... :) :) :hihi: Thank you, Pyrotex. I've added this to my list of things to research. It sounds like this would lend itself handily to a language of languages. What would you call an operator which does what you describe? I would very much like to implement this with bounds into the language as a standard operator. By the way, I'm looking for a name for the language of languages. The candidates I've come up with are: "Dialectics", "Uni-lex", "Babel", "GEB", "Tangle", or "Polyglot". Now that I think about it, maybe the language should be implemented in dialects? Quote
IDMclean Posted April 24, 2009 Author Report Posted April 24, 2009 I've started to conceive of TLoL (the Language of Languages) as colonies of specialized languages which may use the output of and modify each of the other languages. XML would act as TLoL's Declarative language, describing how things maybe declared in TLoL. (or something like XML)Something like Pyrotex's HLL might exist as the operator language, defining the behavior of TLoL's operators.Some form of [Math]\lambda[/math]-Calculus language would form the functional language, defining the behavior of TLoL's functions.XML, HLL, and [Math]\lambda[/math]-Calculus language might be extended into an object-oriented language which would define the behavior and properties of objects in TLoL.I envision making use of imperative/state, procedural, genetic, and structural (describes data structures) dialects to handle the specialized applications of TLoL. The trick of the language would be to identify the context of a phenomena--problem or solution--via pattern recognition, and once so identified, evolve the expression of that phenomena towards a family of more ideal phenomena via rewriting/gene-hacking. Express a phenomena using the best suited set of languages and develop languages to express new phenomena. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.