Pattern Matching

tommy.nordgren@chello.se
4 Mar 2005 14:26:30 -0500

          From comp.compilers

Related articles
pattern matching aldeeran@tin.it (alderaan) (2003-11-21)
Re: pattern matching basile-news@starynkevitch.net (Basile STARYNKEVITCH) (2003-12-03)
Pattern Matching tommy.nordgren@chello.se (2005-03-04)
Re: Pattern Matching hannah@schlund.de (2005-05-19)
| List of all articles for this month |
From: tommy.nordgren@chello.se
Newsgroups: comp.compilers
Date: 4 Mar 2005 14:26:30 -0500
Organization: Compilers Central
Keywords: question
Posted-Date: 04 Mar 2005 14:26:30 EST

I am interested in implementing an interactive fiction language as a hobby
project. My language will have methods declared as follows: class myClass:
baseclasses myMethod(a _ omeClass,b _ SomeOtherClass)_ ReturnType = block


myMethod(a _ AlfaClass,b _ BetaClass)_ ReturnType = block.


endclass;


A method implementation should be tried before another if it is more
specialized in all it's arguments. Methods mentioning at least one
specific object should be tried first of all. If neither is more
specialized (ie less specialized in one arg and more specialized in
another) they should be tried in the order declared.


The only differences between classes and object in the language will
be that classes are prefixed by the word 'class', and that only
objects will be matched by the player command parser.


What I want to ask about now is about efficient ways to implement the
pattern matching algorithm, in code that will be run by a bytecode
interpreter


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.