on 31/3/00 9:49 AM, Alain Farmer at [EMAIL PROTECTED] wrote:

>> Adrian: I have just uploaded my Augmented
>> Transitional Network parser to the
>> FreeCard server (in the download/Adrian) folder.
> 
> Alain: Hey!  It's a stack.  :)

Adrian: Yep, I decided that was much easier than learning LISP. :)  It also
means that FreeCard will be able to run it's own interpreter, which is
pretty important.

>> Adrian: I was unable to provide a ..sit.hqx
>> version as all of my attempts to compress it
>> resulted in a corrupted stuffit archive.
> 
> Alain: No trouble of that sort here. What version of
> stuffit are you using?

Adrian: Stuffit 5 I think, but I've done all kinds of strange things to my
mac side recently.  I'm currently dual booting with Linux and preparing to
try an install of Darwin.

>> Adrian: Could someone stuff and hqx this for me?
> 
> Alain: Done. Here is the full URL. Watch out for the
> line break, eh!
> 
> http://ufp.uqam.ca/opencard/downloads/adrian/ATNParser.stak.sit.hqx

Adrian: Thank you.

>> Adrian: I have yet to define the networks but
>> it is capable of parsing any transitional network
>> you give it.
> 
> Alain: Where did this come from? Did you make it
> yourself? Did you borrow it from someone else?

Adrian: I wrote the parser myself.  I have developed it in increments over
the past week.  The final code was rewritten from scatch in just a couple of
hours though.  The network that is currently stored in it is a well-known
one from many natural language processing text books.

>> Adrian: So you could use it to parse FreeScript
>> or natural language.
> 
> Alain: Could I use it to parse AlainScript?  ;-)

Adrian: If you designed the network to parse it and entered in the details.

> Alain: In other words, is there any way for ME to
> prototype some new syntax?

Adrian: Yes.  However, the FreeCard interpreter may need to be extended to
provide the new functionality required.  The parser simply creates a byte
code (or will when the network is fully defined.  The first step will be
just to check if the code is valid and return true or false).

>> Adrian: The network that is currently in it
>> parses basic english sentences
>> ("The boy kissed the dog")
>> and tells you if they're valid sentences or not.
> 
> Alain: "put myVar into myContainer", and other simple
> FC declarations like it, will be a cinch to parse
> then, eh! Right out of the box?

Adrian: Certainly.  My current deadline is that it can validate any
hypertalk statment in two weeks time.

> Alain: What is the output of this network like? Is it
> byteCode?? Or merely a logical (true or false) value??

Adrian: Let me first explain the basic principles of an Augmented
Transitional Network.

1) A network consists of a sequence of nodes which are connected by arcs.

Eg.
1 -> 2 -> 3

2) Each arc has a label which is either a word category (noun, verb
adjective etc) or the name of a network (nounphrase, verbphrase, sentence or
any other network which is defined).

Eg.
1 -determina-> 2 -noun-> 3

3) There can be multiple arcs between nodes and arcs can "skip" nodes.  ie
an arc can go from node one to node three.

4) Arcs can be labelled "jump" to indicate that the arc can be crossed
without matching a word of the input.

5) Arcs can be labelled "send" which indicates the end of the network.  When
a send arc is taken the parse for that network is successful.  Send arcs
have no destination.

6) For every parse, there are a set of registers or variables which store
any given value (they're used by the conditions and actions described
below).

7) Every arc can have a set of conditions which must be true for the arc to
be crossed.  eg verbtype is "passive"

8) Every arc can have a set of actions which are executed when the arc is
crossed.  These actions set register values.  In my parser the action can be
any valid hypertalk statement, hence the "answer test" action on arc 2.

Adrian: Okay, so, the parser goes through the network, matching words to the
arc labels and progressing through the sentence.  If the parser reaches a
"send" arc it returns true.  In this sense the parser will only ever return
true or false.  However, we can use actions to set the registers so that
they represent the required bytecode for the given command.

Adrian: So for the put x into y command.  There is the command "put", the
value "x" and the target "y".  So we need to have three registers, command,
value and target and then we develop a network which parses the statement
and stores the correct values in each register.  I'm yet to work out the
details of this as my first objective is simply to check that the statement
is a valid HyperTalk statement.

Adrian: I hope this makes some kind of sense.  I will document the parser
stack better so that you can more successfully play with it when I next have
time.

Adrian Sutton

**************************************************************
Email: [EMAIL PROTECTED]                    Ph: 3714 4649
We have nine children now ‹ half boys and half girls.
  -- Mark Twain.
**************************************************************

Reply via email to