• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

4.13 DCG Grammar rules
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • DCG Grammar rules
          • phrase/2
          • phrase/3
          • call_dcg/3
    • Packages
Availability:built-in
Sourcecall_dcg(:DCGBody, ?State0, ?State)
As phrase/3, but without type checking State0 and State. This allows for using DCG rules for threading an arbitrary state variable. This predicate was introduced after type checking was added to phrase/3.85After discussion with Samer Abdallah.

A portable solution for threading state through a DCG can be implemented by wrapping the state in a list and use the DCG semicontext facility. Subsequently, the following predicates may be used to access and modify the state:86This solution was proposed by Markus Triska.

state(S), [S] --> [S].
state(S0, S), [S] --> [S0].

ClioPatria (version V3.1.1-51-ga0b30a5)