How to parse Text with braces

Nov 7, 2013 at 7:25 PM
Edited Nov 7, 2013 at 7:40 PM
Hi,

I am looking for help about text containing multilevel of braces.
For example with this text :
{{abc|{cde|fgh}} bb|cc}
I want to obtain
{abc bb|cde bb|fgh bb|cc}

and with this
pp {vv {ff|ii|nn|aa} | {ee|hh|rr} } xx {{abc|{cde|fgh} bb|cc}
the results is
pp {vv ff|vv ii|vv nn|vv aa | ee|hh|rr} xx {abc bb|cde bb|fgh bb|cc}

The idea is to put the text with several levels of braces only one level of braces.
To achieve this I think a non-regular expression grammar parser in order to parse the text to a sequence of tokens.

Is that possible with Irony ?
Rem: I dont't know BNF.

Any help is appreciated.

Thanks .
Coordinator
Nov 9, 2013 at 5:30 PM
what you have at hand, as far as I understand, is conversion of text expression applying arithm distribution rule like ' (a + b) * c = ac + bc'
That naturally splits into 2 steps:
  1. Parsing the input text and producing parse tree or AST tree; and if you don't know BNF - too bad, you can't use Irony without this stuff.
  2. Walking the tree and converting it while applying distribution rule
  3. - if you need text, generating text back from the converted tree
    Roman