mirror of
https://github.com/boostorg/metaparse.git
synced 2026-01-19 04:22:10 +00:00
Fix typo in doc.
This commit is contained in:
@@ -18,7 +18,7 @@ This is a [link parser_combinator parser combinator].
|
||||
|
||||
It applies `P` on the input. When `P` succeeds, `change_error_message` returns
|
||||
the result `P` returns, otherwise `change_error_message` rejects the input and
|
||||
the reson will be `Msg`.
|
||||
the reason will be `Msg`.
|
||||
|
||||
[h1 Header]
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ The key components of the library:
|
||||
* [*Why template metaprogramming?]
|
||||
|
||||
An alternative is using `constexpr` functions instead of template metaprograms.
|
||||
There are ceratin things that are difficult (if possible) using `constexpr`
|
||||
functions: building containers (at compile-time) the lenght of which depend on
|
||||
There are certain things that are difficult (if possible) using `constexpr`
|
||||
functions: building containers (at compile-time) the length of which depend on
|
||||
the parsed text (eg. parsing a JSON list), generating and validating types (eg.
|
||||
`printf`).
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ For example, you can start Metashell with the following arguments:
|
||||
|
||||
$ metashell -I$BOOST_ROOT -I$BOOST_ROOT/libs/metaparse/example/getting_started
|
||||
|
||||
`$BOOST_ROOT` refers to the the ['boost root directory] (where you have checked
|
||||
`$BOOST_ROOT` refers to the ['boost root directory] (where you have checked
|
||||
out the Boost source code).
|
||||
|
||||
This tutorial is long and therefore you might want to make shorter or longer
|
||||
@@ -40,7 +40,7 @@ section.
|
||||
|
||||
[note
|
||||
You have access to these headers in the online Metashell demo as well. For
|
||||
example you can include the `<boost/metaparase/getting_started/5_2_1.hpp>`
|
||||
example you can include the `<boost/metaparse/getting_started/5_2_1.hpp>`
|
||||
header to start from section 5.2.1.
|
||||
]
|
||||
|
||||
@@ -1541,7 +1541,7 @@ Our calculator language provides no direct support for negative numbers. To get
|
||||
a negative number, we need to do a subtraction. For example to get the number
|
||||
`-13` we need to evaluate the expression `0 - 13`.
|
||||
|
||||
We will implement `-` as an unary operator. Therefore the expression `-13` won't
|
||||
We will implement `-` as a unary operator. Therefore the expression `-13` won't
|
||||
be a ['negative number]. It will be the unary `-` operator applied on the number
|
||||
`13`.
|
||||
|
||||
@@ -1900,7 +1900,7 @@ before:
|
||||
|
||||
[link getting_started_37 copy-paste friendly version]
|
||||
|
||||
We can can try to give our new parser an invalid input:
|
||||
We can try to give our new parser an invalid input:
|
||||
|
||||
> exp_parser20::apply<BOOST_METAPARSE_STRING("hello")>::type
|
||||
<< compilation error >>
|
||||
|
||||
@@ -202,7 +202,7 @@ the parser [link repeated `repeated`]`<int_token>`) one by one.
|
||||
Note that [link transform `transform`] wraps another parser,
|
||||
[link repeated `repeated`]`<int_token>` here. It parses the input with that
|
||||
parser, gets the result of that parsing and changes that result.
|
||||
[link transform `transfrom`] itself will be a parser returning that updated
|
||||
[link transform `transform`] itself will be a parser returning that updated
|
||||
result.
|
||||
]
|
||||
|
||||
@@ -210,7 +210,7 @@ the parser [link repeated `repeated`]`<int_token>`) one by one.
|
||||
[section Introducing foldl]
|
||||
|
||||
It works, however, this is rather inefficient: it has a loop parsing the
|
||||
integers one by one, building a typlist and then it loops over this typelist to
|
||||
integers one by one, building a typelist and then it loops over this typelist to
|
||||
summarise the result. Using template metaprograms in your applications can have
|
||||
a serious impact on the compiler's memory usage and the speed of the
|
||||
compilation, therefore I recommend being careful with these things.
|
||||
@@ -241,7 +241,7 @@ input:
|
||||
As you can see, not only the implementation of the parser is more compact, but
|
||||
it achieves the same result by doing less as well. It parses the input by
|
||||
applying `int_token` repeatedly, just like the previous solution. But it
|
||||
produces the final result without buliding a typelist as an internal step. Here
|
||||
produces the final result without building a typelist as an internal step. Here
|
||||
is how it works internally:
|
||||
|
||||
[$images/metaparse/foldl_diag2.png [width 70%]]
|
||||
@@ -416,7 +416,7 @@ following input for example:
|
||||
|
||||
BOOST_METAPARSE_STRING("11 + 13 + 3 + 21 +")
|
||||
|
||||
This is an ivalid expression. However, if we parse it using the
|
||||
This is an invalid expression. However, if we parse it using the
|
||||
[link foldl_start_with_parser `foldl_start_with_parser`]-based parser presented
|
||||
earlier (`sum_parser3`), it accepts the input and the result is `48`. This is
|
||||
because [link foldl_start_with_parser `foldl_start_with_parser`] parses the
|
||||
@@ -498,7 +498,7 @@ at compile-time. Here is a list of things that can be the "result" of parsing:
|
||||
`regex` example of Metaparse for an example.
|
||||
* A C++ ['function], which might be called at runtime. A C++ function can be
|
||||
generated that can be called at runtime. It is good for generating native
|
||||
(and optimisied) code from EDSLs. See the `compile_to_native_code` example of
|
||||
(and optimised) code from EDSLs. See the `compile_to_native_code` example of
|
||||
Metaparse as an example for this.
|
||||
* A [link metafunction_class ['template metafunction class]]. The result of
|
||||
parsing might be a type, which is a
|
||||
|
||||
@@ -16,7 +16,7 @@ Template metafunction are expected to be called with
|
||||
|
||||
Template metafunctions are expected to return template metaprogramming values.
|
||||
|
||||
For example this is the identitiy template metafunction:
|
||||
For example this is the identity template metafunction:
|
||||
|
||||
template <class T>
|
||||
struct identity
|
||||
|
||||
@@ -9,7 +9,7 @@ their result. This makes it possible to implement
|
||||
template metafunctions as arguments or returning template metafunctions as their
|
||||
result.
|
||||
|
||||
For example this is the identitiy template metafunction class:
|
||||
For example this is the identity template metafunction class:
|
||||
|
||||
struct identity
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ This is a [link parser_combinator parser combinator].
|
||||
|
||||
[h1 Description]
|
||||
|
||||
It tries parsing the input with `P`. When `P` succeeds, the rsult of parsing is
|
||||
It tries parsing the input with `P`. When `P` succeeds, the result of parsing is
|
||||
the result of `P`. Otherwise no characters are consumed and the result of
|
||||
parsing is `Default`.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Parsers work at compile-time, thus their performance affects compilation speed.
|
||||
This section shows measurements of compilation time using Metaparse. The
|
||||
measurements were done on a Linux laptop with an 1.6 GHz Atom processor and 1 GB
|
||||
memory. The measurements were done using GCC 4.6.1 with `-std=c++0x` and no
|
||||
optimalisation. Compilation speed was measured using the `time` utility.
|
||||
optimisation. Compilation speed was measured using the `time` utility.
|
||||
|
||||
To measure a non-trivial parser, the `printf` example program were used for
|
||||
measurements. Here is a list of the `printf` calls and their compilation speed
|
||||
|
||||
@@ -60,11 +60,11 @@ This technique has the advantages over parsing the content of string literals
|
||||
* is faster in most cases
|
||||
* APIs using this technique can "emerge" as a process of advancing the API of a
|
||||
library step-by-step. Moving to a completely new DSL (with its own syntax) is
|
||||
a realtively big step.
|
||||
a relatively big step.
|
||||
|
||||
Using expression templates for DSL embedding has the following disadvantages:
|
||||
|
||||
* the syntax of the embededd DSL is limited. It has to be a valid C++
|
||||
* the syntax of the embedded DSL is limited. It has to be a valid C++
|
||||
expression. For most libraries, people familiar with the original DSL usually
|
||||
need to learn the library's syntax to understand the embedded code snippets.
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
[section Repetition]
|
||||
|
||||
See the [link repetition Repetition] section of the
|
||||
[link manual User Manual] for a detailed comparisan of the most common
|
||||
[link manual User Manual] for a detailed comparison of the most common
|
||||
repetition combinators.
|
||||
|
||||
[link finding-the-right-folding-parser-combinator Cheat-sheet] for
|
||||
|
||||
@@ -18,7 +18,7 @@ character.
|
||||
|
||||
[h1 Expression semantics]
|
||||
|
||||
The followin are equivalent:
|
||||
The following are equivalent:
|
||||
|
||||
space
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
[section Tag]
|
||||
|
||||
A ['tag] is a [link metaprogramming_value template metaprogramming value] used
|
||||
to identifiy groups of values.
|
||||
to identify groups of values.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ This is a [link parser_combinator parser combinator].
|
||||
[h1 Description]
|
||||
|
||||
`transform` parses the input using `P` and transforms the result `P` returns
|
||||
with `T`. The result of parsing is what `T` returns. When `P` fails, the faliure
|
||||
with `T`. The result of parsing is what `T` returns. When `P` fails, the failure
|
||||
is returned unchanged.
|
||||
|
||||
[h1 Header]
|
||||
|
||||
@@ -39,7 +39,7 @@ support them.
|
||||
Macros defined by the library are prefixed with `BOOST_METAPARSE_V1_`. For
|
||||
example `BOOST_METAPARSE_V1_STRING`. It is defined in the
|
||||
`<boost/metaparse/v1/string.hpp>` header file. The library provides the
|
||||
`<boost/metaparse/srting.hpp>` header file as well, which includes the
|
||||
`<boost/metaparse/string.hpp>` header file as well, which includes the
|
||||
definition of this macro and provides the following definition:
|
||||
|
||||
#define BOOST_METAPARSE_STRING BOOST_METAPARSE_V1_STRING
|
||||
|
||||
Reference in New Issue
Block a user