>>>>> "DC" == Damian Conway <dam...@conway.org> writes:
DC> * Grammars built into the language: DC> grammar Expr::Arithetic { DC> rule Expression { <Mult> ** $<OP>=< + - > } DC> rule Mult { <Pow> ** $<OP>=< * / % > } DC> rule Pow { <Term> ** $<OP>=< ^ > } DC> token Term { DC> <Literal> DC> | '(' <Expression> ')' DC> } DC> token Literal { <[+\-]>? \d+ [ \. \d+ ]? } DC> } DC> * Grammar inheritance: DC> grammar Expr::Algebraic is Expr::Arithetic { DC> token Literal { DC> <alpha>+ DC> | <Expr::Arithetic::Literal> DC> } DC> } when i promote p6, the first and biggest thing i talk about grammars. many of the other neat things (and damian listed a good bunch) can be found in other langs or are nice but focused and small. p6 grammars are like nothing out there especially in any mainstream lang today. and they are BIG in scope of what they can do. also they are very accessible to newbies as they are based on the familiar regexes we all use (and in almost all modern langs too). the mapping of grammar rules to methods/subs and inheritance (which i generally despise but is totally appropriate in grammars) is also amazing. now you can use grammar libs and customize them as desired with little effort. before this if you did have a grammar/parser (in any lang/system) you had to learn its guts in detail before you dared to touch it. also grammars can do dynamic things like build up a parsed data tree on the fly. you will get what you expect (DWIM) with arrays of repeated grabbed sections (properly nested as it follows your grammar). these are holy grails of parsing and they come built in with incredible ease of use. note how every other lang claims a perl5 compatible regex engine (and they lie as none can do s///e among other things :). now with p6 they will never be able to copy its grammars as it is a core part of p6 and not some regex lib. so you can talk about this amazing feature and be assured that the audience will be amazed. :) thanx, uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Free Perl Training --- http://perlhunter.com/college.html --------- --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------