JFLAP - Regular Expressions

Steven Zeil

Last modified: Sep 21, 2016
Contents:
1 JFLAP

Abstract

JFLAP offers facilities for working with NFAs and with regular expressions. Students will practice with both.

1 JFLAP

  1. Return to the Finite Automata_ section of the Tutorial. Read the subsection devoted to Nondeterministic Finite Automata.

  2. Try constructing the NFA in Figure 3.7 of your text. Try running it on each of the following inputs to see if it works as expected:

    Save your NFA.

  3. Try constructing the NFA in Figure 3.10 of your text. This one uses a lambda transition, unlike the previous one.

    Note: JFLAP marks lambda transitions with a lower-case $\lambda$ instead of the upper-case $\Lambda$ used in your textbook. Both conventions are quite common. I actually prefer the lower-case myself because elsewhere we have been following the convention of using upper-case (Roman) letters to denote sets and lower-case letter to denote individual symbols from our alphabet.

    Try running your NFA on each of the following inputs to see if it works as expected:

    Save your NFA.

  4. JFLAP can convert NFAs to DFAs. Try converting each of your saved NFAs. Notice that the process used is directly comparable to the process described in section 3.3 of your text.

  5. Read the Regular Expressions section of the
    JFLAP Tutorial.

  6. Although JFLAP can be used to check regular expressions against strings, you can actually do that with ordinary Linux commands. You may recall that grep is a program that tests lines of text against a regular expression, echoing those lines that match. We can convert the Marting & JFLAP style regular expressions to Linux regular expressions pretty easily:

    So if we wanted to check various strings against the regular expression $(a + b)^*$, we could give the commands

    echo a | grep -E -x '(a|b)*'
    

    This command will either print our string if it matches or will print nothing if it does not. (The ‘-E’ selects the “extended” form of grep that makes full regular expression processing available.)

    Try testing that regular expression with each of the following strings:

    You can enter $\lambda$ (the empty string) for testing by using two quotes with nothing between them ('' or ""). Try testing the empty string against these regular expressions:

    There is a difference in the output, subtle though it may be.