Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sasa
:- module('automata/printing', [regex_to_string/2, format_table/1 ]). :- meta_predicate regex_to_string(+, -), format_table(+). /** <module> Predicates for pretty printing This module defines predicates useful to print structures generated by other automata modules. @see https://github.com/wvxvw/intro-to-automata-theory */ :- use_module('automata/ast'). vexp(rterminal(C)) --> { C = [], !, R = 603 ; char_code(C, R) }, [R]. vexp(runion(L, R)) --> "(", vexp(L), "+", vexp(R), ")". vexp(rstar(E)) --> "(", vexp(E), ")*". vexp(rconcat(L, R)) --> vexp(L), vexp(R). %% regex_to_string(+Exp, -Result) is det. % % Evaluates to true when given regular expression Exp can be written % as Result string. % % @see regex/1 regex_to_string(Exp, Result) :- phrase(vexp(Exp), Codes), text_to_string(Codes, Result). format_table_helper([]). format_table_helper([row(N, Row) | Table]) :- format('~w | ~w |~n', [N, Row]), format_table_helper(Table). %% format_table(+Table:table) is det. % % Pretty-prints the contents of the transitions table. % % @see nfa_to_dfa/2, nfa_table/2 format_table(table(Inputs, Table)) :- format('~w~n', [Inputs]), format_table_helper(Table).
run
|
edit
|
history
|
help
0
Array para polizona 1
Codificación y despliegue de redes bayesianas
Leonardo Calvillo Tapia Ejercicio 3 de examen
Guzman_Goiz_if_anidado
Prolog-superquery2
Ejercicio Introductorio Clase 1 - Guzmán Martínez Ricardo Alejandro
Tarea Query
mmm
QUERYS-AGUIRREMONTOYALIZETH-SEC3NM70
EMPRESA_COMPLETA