diff --git a/Module3/SimpleLex.lex b/Module3/SimpleLex.lex
index c0434f09b6e8ca1adf55cd70f9ae3e4b18e41e45..27f95d66cd2d0e81e4a22a7379204d0f6018c16f 100644
--- a/Module3/SimpleLex.lex
+++ b/Module3/SimpleLex.lex
@@ -7,24 +7,63 @@ AlphaDigit {Alpha}|{Digit}
 INTNUM  {Digit}+
 REALNUM {INTNUM}\.{INTNUM}
 ID {Alpha}{AlphaDigit}* 
+DotChr [^\r\n]
+OneLineCmnt  \/\/{DotChr}*
+
+Chars [^']
+STRING  \'{Chars}*\'
 
 // Здесь можно делать описания типов, переменных и методов - они попадают в класс Scanner
 %{
   public int LexValueInt;
   public double LexValueDouble;
+
+  public int idCount = 0; 
+  public int maxIdLength = int.MinValue;
+  public int minIdLength = int.MaxValue;
+  public double avgIdLength;
+
+  public int sumInt = 0;
+  public double sumDouble = 0.0;
+
+  public List<string> idsInComment = new List<string>();
 %}
 
+%x COMMENT
+
 %%
 {INTNUM} { 
   LexValueInt = int.Parse(yytext);
+  sumInt += LexValueInt;
   return (int)Tok.INUM;
 }
 
 {REALNUM} { 
   LexValueDouble = double.Parse(yytext);
+  sumDouble += LexValueDouble;
   return (int)Tok.RNUM;
 }
 
+{STRING} {
+	return (int)Tok.STRINGAP;
+}
+
+{OneLineCmnt} {
+	
+}
+
+"{" { 
+  // переход в состояние COMMENT
+  BEGIN(COMMENT);
+}
+
+<COMMENT> "}" { 
+  // переход в состояние INITIAL
+  BEGIN(INITIAL);
+}
+
+
+
 begin { 
   return (int)Tok.BEGIN;
 }
@@ -37,7 +76,30 @@ cycle {
   return (int)Tok.CYCLE;
 }
 
+
+<COMMENT> {ID} {
+  if(yytext != "begin" && yytext != "end" && yytext != "cycle"){
+	idsInComment.Add(yytext);
+  }
+}
+
 {ID}  { 
+	if(yytext == "begin"){
+		return (int)Tok.BEGIN;
+	}
+
+  idCount += 1;
+
+  if(yytext.Length > maxIdLength){
+	maxIdLength = yytext.Length;
+  }
+
+  if(yytext.Length < minIdLength){
+	minIdLength = yytext.Length;
+  }
+
+  avgIdLength += yytext.Length;
+
   return (int)Tok.ID;
 }
 
@@ -53,11 +115,17 @@ cycle {
   return (int)Tok.SEMICOLON;
 }
 
+[\0] {
+	avgIdLength /= idCount;
+	return 0;
+}
+
 [^ \r\n] {
 	LexError();
 	return 0; // конец разбора
 }
 
+
 %%
 
 // Здесь можно делать описания переменных и методов - они тоже попадают в класс Scanner