Language without a name

Michael Feathers <[email protected]> Thu, 16 Jun 2005 19:51:12 -0400
Newsgroups gmane.comp.programming.emergent-design
Message-ID <[email protected]>
Here's a chance to talk about something emergent..  I like languages.  
For fun, I've been writing an interpreter for a new one.  It is sort of 
a prototype-based mix of Smalltalk and Python syntax.  I've had a 
fascination with prototype-based languages ever since I read Brian 
Foote's Prototype Pattern (maybe before) and typed in his Ego interpreter.

Right now, I have a tokenizer that is indentation aware and I'm building 
up recognizers for the phrase structure.  I'm doing it test-first and I 
don't have much of a sense of what the architecture of the interpreter 
will be, but it seems to be coming along fine.  If anyone wants to see 
the code, feel free to ask.  I don't plan on making it a very useful 
language.  The world is littered with those already ;) 

I've been using the folowing example code as a guide while I work.  It's 
code I expect the interpreter to accept. 

false ifTrue: aBlock
   pass

false ifFalse: aBlock
   aBlock value

true ifTrue: aBlock
   aBlock value

true ifFalse: aBlock
   pass

test tests := list clone

test setUp
   pass

test tearDown
   pass

self runTest
   self should: false
 
test should: aBool
   aBool ifFalse:
       self hurl: "bad things"

test run: aResult
       self do:
           self setUp
           self runTest
           self tearDown
       ifUnable:
           e | aResult addMessage: e

divTest := test clone

divTest runTest: aResult
   self should: ((10 / 2) = 5)

testSuite add: test
   self tests add: test

testSuite run: aResult
   self tests do:
       aTest | aTest run: aResult

object slots
   self _

object clone
   result | self slots forEach:
       slot | result slots add: slot
   result


Michael Feathers

>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emergentdesign/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/