Creating a deterministic finite automata (DFA) - Mercury

不羁的心 提交于 2019-12-01 10:52:24

When you write a type such as mystate:

:- type transition ---> trans(source_state::mystate, input_character::bool, final_state::mystate).

Don't write it out all on one line, it is difficult to read.

:- type transition
    --->    trans(
                source_state     :: mystate,
                input_character  :: bool,
                final_state      :: mystate
            ).

Now it is much easier to read. We can also see that the types and field names are arround the wrong way. Try:

:- type transition
    --->    trans(
                mystate  :: source_state,
                bool     :: input_character,
                mystate  :: final_state
            ).
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!