Re: Tree Creation



Pascal Bourguignon wrote:
"Dustin Withers" <fadeddata@xxxxxxxxx> writes:

Hello All,

I'm working on a project to parse EDI documents and I'm learning Lisp
at the same time :) It's not anything that needs to be done quickly (we
are already using an outsourced application) but I would love to use
Lisp in a production environment.

Given this mapping:
(defparameter *850-mapping*
'((("ISA")
(("GS")
(("ST"))
(("BEG"))
(("CSH"))
(("DTM"))
(("N1"))
(("PO1")
(("CTP"))
(("PID"))
(("PO4")))
(("CTT")))
(("SE"))
(("GE")))
(("IEA"))))

This defines a grammar (it might be useful to put it in a more
grammar-like form thought).


What would be a more grammar-like form? EDI documents (ASCX12) have two
delimters, a segment and an element delimiter. The first "element" of
the segment is the name of the segment. Each subsequent element, up to
the next segment, is sequentially referenced (BEG01, BEG02, etc...).
The document itself contains no relationship data. I'm trying to
figure out what a more verbose mapping would be. Rainer Joswigs DSL
example uses character indexes of the rows and his mapping is very
simple and straightforward. I don't know what other information I could
include in the mapping that would make it more of a grammar definition.
Should I use CL-PPCRE to define the grammar? Currently I'm using
SPLIT-SEQUENCE to break the document into a list representation.


What might be a good direction for me to head in if I want to turn the
semi-parsed document into:

Therefore I would write a parser generator from the grammar specified.


--
__Pascal Bourguignon__ http://www.informatimago.com/

"Logiciels libres : nourris au code source sans farine animale."

Thanks for the help on this,
-dustin

.



Relevant Pages

  • Re: Constructibility of X -> X^2 bijection
    ... Consider the mapping from the ... enumerates exactly the elements of X (or a grammar that enumerates ... the first two characters in the alphabet. ... characters, changing the ordering of the expressions, thus changing ...
    (sci.math)
  • Re: Tree Creation
    ... I'm working on a project to parse EDI documents and I'm learning Lisp ... Therefore I would write a parser generator from the grammar specified. ...
    (comp.lang.lisp)
  • comprehensive example file for scripting
    ... and programs/window specific Dragonfly scripts. ... notepad_series_rule = SeriesMappingRule( ... grammar = grammar_list.pop ...
    (comp.lang.beta)

Loading