For Programmers: Free Programming Magazines  


Home > Archive > Compilers > August 2005 > Re: Inquiry about nfa output by flex









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Inquiry about nfa output by flex
Vern Paxson

2005-08-05, 10:01 pm

[ In response to a question about flex DFA table formats -John ]

> I assume that the first field represents the state, the second field, the
> ...
> Am I correct in making these assumptions ?


Yes.

> a] I assume (after having mined the source of flex) that "257" refers to
> any character (or '.'). Am I correct ?


257 refers to an "epsilon" transition (i.e., an NFS transition that occurs
without consuming a character).

> b] What do the "-1', "-2", "-3" and "-4" character classes represent ?


They refer to each character class as they are encountered, i.e., the first
in the input is -1, the second -2, etc. Charcter classes are reused,
though (i.e., a second reference to the same class will use the same index),
with (I believe) -1 being the '.' character class.

> c] Can someone explain the character classes dumped at the end of the
> "test.out" file ?


These are equivalence classes rather than character classes. So for example:

> Equivalence Classes:
>
> \000 = -1 ' ' = 1 @ = 1 ` = 1 \200 = 1 \240 = 1 \300 = 1 \340
> = 1
> \001 = 1 ! = 1 A = 3 a = 4 \201 = 1 \241 = 1 \301 = 1 \341


This is saying that blank, @, etc., are all in equivalence class 1; the
character 'A' is in class 3; 'a' is in '4' etc.

Vern

bharath

2005-08-10, 5:07 pm

Vern Paxson wrote:
> [ In response to a question about flex DFA table formats -John ]
> ....
> Vern


Some doubts which are related to the points raised but not following
from them.

1. How are the trans1 and trans2 arrays different?
2. Is the meta-equivalence generation an 8-to-1 affair i.e., one
meta-equivalence class for every 8 equivalence classes?
3. Why doesn't flex generate the minimal DFA? Is it because
backtracking becomes more difficult? Also is the DFA generated a
"suffix DFA"?

-- Bharath

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com