Gramatica

Páginas: 2 (407 palabras) Publicado: 29 de marzo de 2011
Instituto Tecnológico Superior de Lerdo

INGENIERÍA EN SISTEMAS COMPUTACIONALES

ESPECIALIDAD BASES DE DATOS

NOMBRE DE LA MATERIA:
Teoría de la Computación

UNIDAD 2

Nombre del maestro:Ing. Manuel Guereca Tijerina

Grupo 4”A”

Nombre: Suyin Hernández Zamago
No. Control: 09231354

29/marzo/2011
Cd. Lerdo Dgo

PROGRAMA DE GRAMATICA
using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace gramatica
{
class Program
{
static void Main(string[] args)
{//Palíndromos con un número par de símbolos
//Realice su gramática

string cadena = "aabbaa";
AP ap = new AP(cadena);
Console.ReadKey();
}class AP
{

protected string cad;
public int S;
public Stack pila;


public AP(string c)
{this.cad = c;
this.S = 0;
this.pila = new Stack();
this.Verifica();
}

public void Verifica()
{foreach (char c in this.cad)
this.S = this.Transicion(this.S, c);

//--------comprobación de estados-----------
if ((S == 1) &&(this.pila.Count == 0))
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("{0}|Cadena aceptada!!!|Edo:{1}", this.cad, this.S);}
else
{
this.S = 0;
Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("{0}|Cadena no aceptada!!!|Edo:{1}", this.cad, this.S);
}
}

//---------------------------------------------------------------//
public int...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Gramatica
  • gramatica
  • GRAMÁTICA
  • Grámatica
  • Gramatica
  • Gramatica
  • gramatica
  • GRAMATICA

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS