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

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



Hi,

Apparently, someone using your language can declare slots independant from each other. He/she can declare for example only 1 parent_slot, or only 1 variable_slot and 1 container_slot, etc. So, if the slots are indeed independant from each other (and are therefore also processable independant from each other), why would you want to sort them in your AST?

If particular slots are dependant from each other, e.g., if someone wants to declare variable_slot he/she needs to have a parent_slot declared. If this is indeed the case, there is something fundamentally wrong in your concrete syntax (i.e. "Productions").

Pieter.


On Fri, 2004-04-30 at 10:58, Søren Andreasen wrote:
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