[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lojban] Re: Parsing NIhO sections of text
de'i li 06 pi'e 08 pi'e 2009 la'o fy. sunrise2000@comcast.net .fy. cusku zoi
skamyxatra.
> I'm trying to parse out sections of Lojban text delimited by sequences
> of NIhO cmavo into their respective paragraphs, sections, chapters,
> etc.
...
> Does anyone here know how I could use contetx-free grammar rules to
> parse the different sections separated by NIhO sequences?
>
> Any ideas (expressed in EBNF, Prolog, YACC, or whatever you speak)
> would be much appreciated!
.skamyxatra
If the length of a NIhO sequence exceeds the maximum depth of the parse
tree/list/structure, can't you just enclose the list in another list until the
depths match? E.g., when you have the list X=[[broda, broda], [broda]], and
you encounter four NIhOs in a row, let X=[[X]] (two levels of lists because
four minus the depth of X is two), and then append to X whatever comes after
that.
I don't think this can be handled by a CFG without encoding the lengths of the
NIhO strings into the productions, which would lead to an infinitely large
grammar. Note that the official Yacc and BNF grammars treat a sequence of
NIhOs as a single NIhO and leave the structuring of the text to whatever
semantic engine comes after.
mu'omi'e .kamymecraijun.
--
li'a .e'i ca vondei .i mi na'e pu'i kufra loi vondei
To unsubscribe from this list, send mail to lojban-list-request@lojban.org
with the subject unsubscribe, or go to http://www.lojban.org/lsg2/, or if
you're really stuck, send mail to secretary@lojban.org for help.