pizza questions

9 views
Skip to first unread message

Joel Reymont

unread,
May 17, 2012, 4:03:42 PM5/17/12
to gf-...@googlegroups.com
I'm looking to modify the Pizza dialog example [1] to enable lookup of
pizza toppings, etc. outside of the grammar.

For example, I may want to store the available toppings in a database.

I can't make sense of the following categories, though

cat
[Item] ;
[Topping]{1}

Why is it necessary to separately list Item and Topping enclosed in brackets?

Shouldn't just Item and Topping be sufficient?

Also, what is the meaning of {1} in topping above?

Thanks, Joel

[1] http://www.cse.chalmers.se/alumni/bringert/xv/pizza/Pizza.gf

--------------------------------------------------------------------------
AlgoKit: EasyLanguage trading strategies, on the server, w/ Rithmic R|API
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------

Aarne Ranta

unread,
May 17, 2012, 4:16:45 PM5/17/12
to gf-...@googlegroups.com
These are shorthands for list categories. Thus

  cat [Topping] {1} ;

is expanded to the rules

  cat ListTopping ;
  fun BaseTopping : Topping -> ListTopping ;
  fun ConsTopping : Topping -> ListTopping -> ListTopping ;

The number {1} says that the base case has 1 element. The default is 0, used in [Item].

It seems the on-line reference manual doesn't explain this shorthand, sorry for that. The book does, though, and the on-line manual must of course be updated.

  Aarne.
Reply all
Reply to author
Forward
0 new messages