Lab 1: Introduction to NFA->DFA, Subversion, Flex, STL and gdb

  1. How to use Subversion
    weesan@eon:~> svn co https://svn.cs.ucr.edu/svn/cs152/weesan
    Error validating server certificate for 'https://svn.cs.ucr.edu:443':
     - The certificate is not issued by a trusted authority. Use the
       fingerprint to validate the certificate manually!
    Certificate information:
     - Hostname: svn.cs.ucr.edu
     - Valid: from Nov 26 23:58:06 2005 GMT until Nov 26 23:58:06 2006 GMT
     - Issuer: Department of Computer Science and Engineering, UCR, Riverside, California, US
     - Fingerprint: c0:aa:07:ad:16:60:c1:3c:7a:25:2f:0e:47:b3:bb:5e:8b:ec:08:de
    (R)eject, accept (t)emporarily or accept (p)ermanently? p
    Checked out revision 0.
    weesan@eon:~>
    weesan@eon:~> cd weesan
    weesan@eon:~/weesan>
    weesan@eon:~/weesan> svn mkdir lab1
    A         lab1
    weesan@eon:~/weesan> cd lab1
    weesan@eon:~/weesan/lab1>
    weesan@eon:~/weesan/lab1> vi README
    weesan@eon:~/weesan/lab1> cat README 
    WeeSan Lee 
    weesan@eon:~/weesan/lab1> 
    weesan@eon:~/weesan/lab1> svn ci
    Adding         lab1
    Adding         lab1/README
    Transmitting file data .
    Committed revision 1.
    weesan@eon:~/weesan/lab1> 
    weesan@eon:~/weesan/lab1> cd
    weesan@eon:~> 
    weesan@eon:~> rm -rf weesan
    weesan@eon:~> 
    weesan@eon:~> svn co https://svn.cs.ucr.edu/svn/cs152/weesan/lab1
    A  lab1/README
    Checked out revision 1.
    weesan@eon:~> 
    weesan@eon:~> cd lab1
    weesan@eon:~/lab1> 
    weesan@eon:~/lab1> ls -l
    total 0
    -rw-------  1 weesan csgrads 31 Jan  9 17:41 README
    weesan@eon:~/lab1> 
    weesan@eon:~/lab1> cat README 
    WeeSan Lee 
    weesan@eon:~/lab1> 
    weesan@eon:~/lab1> cd
    weesan@eon:~> rm -rf lab1
    weesan@eon:~> 
    
  2. A very simple Flex example
    Flex program: lab1.l
    %{
    
    /*
     * lab1.l
     *
     * To compile, do the following:
     *   $ flex lab1.l
     *   $ gcc lex.yy.c -o lab1 -lfl
     *
     * To run, do the following:
     *   $ lab1 < Factorial.java
     */
    
    #include <stdio.h>
    
    %}
    
    ws  [ \n\t]+
    
    %%
    
    [A-Za-z0-9_]+ {
        printf("[%s]\n", yytext);
    }
    
    {ws} {
    }
    
    .
    
    %%
    
    int main(void) {
        yylex();
        return (0);
    }
    
    Input file: Factorial.java
    
    class Factorial{
        public static void main(String[] a){
            System.out.println(new Fac().ComputeFac(10));
        }
    }
    
    class Fac {
        public int ComputeFac(int num){
            int num_aux ;
            if (num < 1)
                num_aux = 1 ;
            else
                num_aux = num * (this.ComputeFac(num-1)) ;
            return num_aux ;
        }
    }
    
  3. STL examples
  4. How to use gdb