Well, verbal expressions are for illustration only, I have in mind smth.
along the lines of:
*input*
../cpan/lib/dev/file.c(11824) : warning C4820: '__unnamed' : '3' bytes
padding added after member 'c'
../cpan/lib/dev/file.c(12464) : warning C4100: 'param' : unreferenced
formal parameter
file.c(12538) : warning C4127: conditional expression is constant
*grammar*
list ::= warning+ separator => [\n]
warning ::= file ('(') line (')') (':' 'warning') code (':') message
file ~ [\w\-:/ \\\.]+ # windows and unix paths
line ~ int
code ~ 'C' int
message ~ [\w' \-:]+ #'
int ~ [\d]+
*output*
[7,
[8,
[9,'../cpan/lib/dev/file.c'],[10,'11824'],[11,'C4820'],[12,' \'__unnamed\'
: \'3\' bytes padding added after member \'c\'']],
[8,
[9,'../cpan/lib/dev/file.c'],[10,'12464'],[11,'C4100'],[12,' \'param\' :
unreferenced formal parameter']],
[8,
[9,'file.c'],[10,'12538'],[11,'C4127'],[12,' conditional expression is
constant']
]
]
7, 8, 9, 10 are IDs of list, warning, file, line
— https://gist.github.com/rns/8625302
What (as I think) is remarkable—how the structure of the grammar naturally
follows from the input, once you split it to parts, give them names and fit
them together.
Now, imagine the same grammar in a regex or, worse, Regexp::Grammars or
Rec::Descent with their punctuation signs overloaded to line noise.
When I thought, for comparison, write the same in regex or Regexp::Grammar
I just wasn't able to make myself do it, so ugly the syntax/semantics
combination started to seem.
On Sun, Jan 26, 2014 at 12:24 AM, Ron Savage <[email protected]> wrote:
> Regexp::VerbalExpressions is certainly an interesting idea. I had not
> heard of it.
>
> Nevertheless, I'm a bit worried the end result looks like Cobol, i.e.
> too wordy. Is it really progress to go from:
> s?
> to
> maybe 's'
> I'm not yet convinced :-).
> Perhaps if you write a use-case I would change my mind.
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.