title: How to write optional in SWI-Prolog
body: <p>I need to implement some rules by Prolog</p>
  
  <p>ex:</p>
  
  <p><code>S ---&gt; A,[b],{c}.</code> </p>
  
  <p>Where: </p>
  
  <p>[b] could happen once or none like 0 or 1 time</p>
  
  <p>{c} could happen 0,1,2,...times</p>
  
  <p>How can i write it?</p>
  
  <p><em><strong>Edit:</em></strong></p>
  
  <p>I used this:</p>
  
  <pre><code>:- op(700,xfx,---&gt;).
  s ---&gt; [vp].
  s ---&gt; [vp,conj,vp].
  s ---&gt; [vp,conj,np].
  vp ---&gt; [feal_amr],
          ([mfoal_beh];[]),
          ([mfoal_beh];[]),
          ([bdl];[]),
          [sefa_optional],
          ([hal];[]),
          ([shbh_gomla];[]),
          ([mfoal_motlk];[]).
  </code></pre>
  
  <p>It gives me an error "Full stop in clause-body?  Cannot redefine ,/2" </p>
  
  <p>in the comma in this line "vp ---> [feal_amr], ..."</p>
  
  <p><em><strong>Edit</em></strong></p>
  
  <p>I use "--->" because i have this</p>
  
  <pre><code>parse_topdown(Category,String,Reststring,[Category|Subtrees]) :-
          Category ---&gt; RHS,
          matches(RHS,String,Reststring,Subtrees).
  </code></pre>
  
  <p>And "-->" gives an error with the operator ":-"?!!</p>
  
  <p><em><strong>this is my code for an</em></strong> <a href="https://www.yousendit.com/download/WUJZblFPdzh3TGhESjlVag" rel="nofollow">Arabic Parser Code</a></p>
  
  <p><strong>I'm sorry for inconvenience but i am not an expert in Prolog</strong></p>