What is an 'immediate eval'? I ask because the following
should only
come from a <EBNF ... EBNF> usage, not a EBNF: ... ;EBNF
usage:
I'm using quasi-Smalltalk terminology, but I figure most of the ideas map,
even though there is no byte-code stage in this compiler.
"Immediate eval": copy and paste your code-snip into the Listener prompt and
hit enter: code is compiled and evaluated and result placed on stack (as
opposed to loading a vocab with a word with your code on it).
> 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 parser 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?
The structure is 'shortened' for printing by default. do a
"dup ." to
print it out fully. It may take a while as it's a deeply
nested
structure. Better might be to right click on it in the
listener and
choose 'inspect', or run the inspect word on it.
Yes, I see. I've already done some inspecting. I guess it's a good
scheme--brevity by default in the stack view.
> 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").
The last part of a rule can be "=> [[ ... ]]" which is an
'action'.
The '...' can be any factor code. It can manipulate the
parse tree and
return a new parse tree.
This is powerful.
So "[0-9] => [[ digit> ]]" takes the parse tree from "[0-9]"
(which is
the character code of the number) and uses the factor word
'digit>' to
convert that into a number. That number is left on the stack
and
becomes the parse tree result of the rule.
Read the help for "peg.ebnf" and let me know if you have any
further
questions. In particular:
http://docs.factorcode.org/content/article-peg.ebnf.action.html
For more general stuff:
http://docs.factorcode.org/content/article-peg.ebnf.html
These are the best links on the subject.
I've noticed that the online EBNF help is not the same as that in the local
Help Browser.
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