Re: Problem with Parsing
- From: Markus Triska <triska@xxxxxx>
- Date: Sun, 16 Jul 2006 20:10:13 +0200
"Advait" <advait_raut@xxxxxxxxxxxxxx> writes:
Do I need to change the structure of grammer or parser clauses ?
s([]) --> [].
s(Toks) -->
space,
s(Toks).
s([Tok|Toks]) -->
word(W),
!, % single solution: longest input match
{ name(Tok, W) },
s(Toks).
space --> " ".
word([L|Ls]) --> letter(L), wordr(Ls).
wordr([L|Ls]) --> letter(L), wordr(Ls).
wordr([]) --> [].
letter(L) --> [L], {0'A =< L, L =< 0'Z ; 0'a =< L, L =< 0'z }.
?- phrase(s(Words), "these are the words").
Words = [these, are, the, words]
.
- References:
- Problem with Parsing
- From: Advait
- Problem with Parsing
- Prev by Date: Problem with Parsing
- Next by Date: Prolog the right tool?
- Previous by thread: Problem with Parsing
- Next by thread: Prolog the right tool?
- Index(es):