automatas

package module
v0.0.0-...-32bd4eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtendedInfixToPosfix

func ExtendedInfixToPosfix(regex *utils.DoublyLinkedList, definitions map[string]*utils.DoublyLinkedList) ([]utils.RegexToken, error)

func ExtendedSimulateAfd

func ExtendedSimulateAfd(expresion string, afd DAfdJson) utils.Stack

func ExtendedValidation

func ExtendedValidation(regex string) (*utils.DoublyLinkedList, error)

func InfixToPosfix

func InfixToPosfix(regex string) (string, error)

func NewFullNodo

func NewFullNodo(Valor rune, Izquierdo *utils.Nodo, Derecho *utils.Nodo, Nullability bool, firstpos []int, lastpos []int) *utils.Nodo

func NewStarNodo

func NewStarNodo(Valor rune, Izquierdo *utils.Nodo, Nullability bool, firstpos []int, lastpos []int) *utils.Nodo

func ReplaceReferenceIds

func ReplaceReferenceIds(definitions map[string]*utils.DoublyLinkedList) (map[string]*utils.DoublyLinkedList, error)

func SimulateDFA

func SimulateDFA(expresion string, estadoInicial string, estadosFinales []string, transiciones map[string]map[string]string) (int, string, error)

Types

type AcceptedExp

type AcceptedExp struct {
	Start int    `json:"start"`
	End   int    `json:"end"`
	Value string `json:"value"`
	Token string `json:"token"`
}

type ArbolExpresion

type ArbolExpresion struct {
	Raiz     *utils.Nodo   `json:"raiz"`
	Simbolos []*utils.Nodo `json:"simbolos"`
}

func (*ArbolExpresion) ConstruirArbol

func (arbol *ArbolExpresion) ConstruirArbol(posfix string)

func (*ArbolExpresion) ExtendedConstruirArbol

func (arbol *ArbolExpresion) ExtendedConstruirArbol(posfix []utils.RegexToken)

func (*ArbolExpresion) ToJson

func (arbol *ArbolExpresion) ToJson() ([]byte, error)

type DAfdJson

type DAfdJson struct {
	Estados        []string                     `json:"estados"`
	Alfabeto       []rune                       `json:"alfabeto"`
	EstadoInicial  string                       `json:"estado_inicial"`
	EstadosFinales []string                     `json:"estados_finales"`
	Transiciones   map[string]map[string]string `json:"transiciones"`
}

func JsonToDfa

func JsonToDfa(jsonData []byte) (*DAfdJson, error)

type DirectAfd

type DirectAfd struct {
	Arbol *ArbolExpresion
	// contains filtered or unexported fields
}

func ExtendedNewDirectAfd

func ExtendedNewDirectAfd(regex []utils.RegexToken) *DirectAfd

func NewDirectAfd

func NewDirectAfd(regex string) *DirectAfd

func (*DirectAfd) MarshalJson

func (afd *DirectAfd) MarshalJson() ([]byte, error)

func (*DirectAfd) ToJson

func (afd *DirectAfd) ToJson() *DAfdJson

type Dstate

type Dstate struct {
	// contains filtered or unexported fields
}

func NewDstate

func NewDstate(nombre string, aceptacion bool, posicion []int) *Dstate

func (*Dstate) AddTransicion

func (d *Dstate) AddTransicion(simbolo rune, estado *Dstate)

func (*Dstate) Print

func (d *Dstate) Print()

type SLR

type SLR struct {
	States     []*utils.LRState `json:"states"`
	StartState int              `json:"start_state"`
}

func (SLR) Closure

func (slr SLR) Closure(items []*utils.Item, productions []*utils.ProductionToken) []*utils.Item

func (SLR) Goto

func (slr SLR) Goto(items []*utils.Item, symbol string, productions []*utils.ProductionToken) []*utils.Item

func (SLR) PrintSLR

func (slr SLR) PrintSLR()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL