Re: Inquiry about nfa output by flex

Vern Paxson <vern@icir.org>
5 Aug 2005 19:06:18 -0400

          From comp.compilers

Related articles
Re: Inquiry about nfa output by flex vern@icir.org (Vern Paxson) (2005-08-05)
Re: Inquiry about nfa output by flex bharath.bhushan@gmail.com (bharath) (2005-08-10)
Re: Inquiry about nfa output by flex vern@icir.org (Vern Paxson) (2005-08-31)
| List of all articles for this month |

From: Vern Paxson <vern@icir.org>
Newsgroups: comp.compilers
Date: 5 Aug 2005 19:06:18 -0400
Organization: Compilers Central
Keywords: lex

[ 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



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.