EBNF: expr
                  digit = '1' | '2' | '3' | '4'
                  number = digit digit*
                  expr = number (('+' | '-') number)*
                  ;EBNF

I was able to evaluate this expression immediately in the Listener and on a
word I defined in my own vocab.

Doing the immediate eval leaves 

T{ parser f ~action-parser~ f 4820 }

How am I expected to use this notation?.  I read:  "a parser instance",
constant f (false), "something to do with a parse and its action", another
false constant, number 4820.  I can't do any real thinking with that. Why
don't we have more informative print-strings for our Tuples/Objects?
 
                Then:
                  "123+456" expr

                Will result in a parse tree left on the stack.


This leaves

V{ ~vector~ ~vector~ }

Again there is the opacity problem.  What does the "~vector~" mean?  And why
would I ever want to read such a general description of a 2-vector?  It
doesn't say much about what is in the tree.

How are the rule statements parsed?  There are no periods between them.  The
EBNF parser must scan forward for the next "<nonterminal>=", to know where
the previous rule ends.  Is this what is happening?



                 The EBNF: name ...
                ;EBNF expression results in a word with 'name' defined that
parses the
                given grammar.

                You can also do:

                <EBNF
                digit = '1' | '2' | '3' | '4'
                number = digit digit*
                expr = number (('+' | '-') number)*
                EBNF>

                This leaves a parser object on the stack which you can call
'parse' on:

                "123" over parse .

This one failed at the listener:

"Generic word parse does not define a method for the parser class.
Dispatching on object:..."


                Or:

                "123" [EBNF
                digit = '1' | '2' | '3' | '4'
                number = digit digit*
                expr = number (('+' | '-') number)*
                EBNF] .

produces

V{ V{ "1" V{ "2" "3" } } V{ } }

which I suppose is the parse tree for the last rule expr. 



                The [EBNF ... EBNF] creates an anonymous quotation and calls
it. This
                is useful for small regexp style grammars:

                                "123" [EBNF digit=[0-9] => [[ digit> ]]
rule=digit+ EBNF] .

This produces 3-vector

V{ 1 2 3 }

I don't understand the parsing of the rule syntax itself between [EBNF and
EBNF].  "digit=[0-9]" and "rule=digit+" are rules strings without
whitespace.  What is happening with the in-between "=> [[ digit> ]]"?  This
looks like Factor (for making a vector) not EBNF, or a mixture of both
(quotation and "one or more"). 
 
I tried word inspect on the above vector.  The inspect said "vector with 3
elements" and showed a grid with nine numbers.  How is that?


Shaping
----------------------------------------------------------------------------
--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to