Best way to interface Java?

Per Bothner per@bothner.com
Wed Jun 21 13:03:00 GMT 2000


"Nic Ferrier" <nferrier@tapsellferrier.co.uk> writes:

> 3. I could pass a OO style proc to the parser
> The proc would take a symbol parameter and a list. The symbol would
> define the action and the list would be the rest of the args.
> 
> As for 1. there is no type-checking which puts me off a bit.

Consider doing what SAX does:  Define a DocumentHandler class
(or use the SAX version), and pass such a handler to your parser:

For example:

public class ScmDocumentHandler extends org.xml.sax.HandlerBase
{
  public void text(FString str)
  { characters(...); }
  ...
}

(parser
  (object (<org.xml.sax.HandlerBase>)
    ((text (arg :: <string)) <void> (print-text arg))
    ...))
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


More information about the Kawa mailing list