[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"alternative1 | alternative2" to " alternative1* alternative2* " ast transformation



Hi,

I have a really big problem. My syntax does not require a bunch of
alternatives to appear in a specific order.
But I would like to sort them in my AST.

Somethin like:
-----------------------------------
Productions

/***********************************************************
§ MI 1.00.00 Abstract Syntax Tree root
***********************************************************/
object = slot*;

/***********************************************************
§ MI 2.00.00 Global slots
***********************************************************/
slot =
  {parent_slot} parent_slot |
  {promote_slot} promote_slot |
  {container_slot} container_slot |
  {import_slot} import_slot |
  {variable_slot} variable_slot |
  {public_slot} public_slot |
  {private_slot} private_slot;

<...>

Abstract Syntax Tree

/***********************************************************
§ MI 1.00.00 Abstract Syntax Tree root
***********************************************************/
object = slot*;

/***********************************************************
§ MI 2.00.00 Global slots
***********************************************************/
slot = parent_slot* promote_slot* container_slot* import_slot*
variable_slot* public_slot* private_slot*;
-----------------------------------

No matter how I try I can't get it to work.. Please help!

Regards, Soeren