Question for pest parser example

I'm studying pest parser from https://pest.rs/book/intro.html
and here is the .pest file below

num = @{ int ~ ("." ~ ASCII_DIGIT*)? ~ (^"e" ~ int)? }
int = { ("+" | "-")? ~ ASCII_DIGIT+ }

operation = _{ add | subtract | multiply | divide | power }
    add      = { "+" }
    subtract = { "-" }
    multiply = { "*" }
    divide   = { "/" }
    power    = { "^" }

expr = { term ~ (operation ~ term)* }
term = _{ num | "(" ~ expr ~ ")" }

calculation = _{ SOI ~ expr ~ EOI }

WHITESPACE = _{ " " | "\t" }

Now here, I'm curious about how to parse parentheses part,
For example,

num = @{ int ~ ("." ~ ASCII_DIGIT*)? ~ (^"e" ~ int)? }
int = { ("+" | "-")? ~ ASCII_DIGIT+ }
expr = { term ~ (operation ~ term)* }

I wanna know how to parse these things, more precisely,
ASCII_DIGIT*)?,
(^"e" ~ int)?,
("+" | "-")?,
ASCII_DIGIT+,
(operation ~ term)*
Can I just parse like the other regardless of ?, +, * things?
Furthermore,

expr = { term ~ (operation ~ term)* }

This thing seems like recursion.
How can I parse this recursive thing?

What do you mean by "how to parse"? Pest generates a parser from the grammar which performs the parsing for you. I get that's not what you are looking for, but what is it, then?

What I meant is this
For exmaple, in the case of expr = { term ~ (operation ~ term)* }

.
.
.
Rule expr => {
    for sub_inner_pair in inner_pair() {
        match sub_inner_pair.as_rule() {
            Rule::num => // some code here
            Rule::expr => // here is what I'm curious. Is it right?
    }
}
.
.
.

Is what right? A production named expr does generate a variant named expr, if that's what you are asking.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.