import argparse
from parglare import Grammar
from parglare import Parser
formula = r"""
Formula : Number | (Formula Sign Formula)
Number : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
Sign : '+' | '-'
"""
grammar = Grammar.from_string(formula)
parser = Parser(grammar, build_tree=True, prefer_shifts=True)
parser = argparse.ArgumentParser()
parser.add_argument('expression')
args = parser.parse_args()
expression = args.expression
print(parser.parse_args(expression))
Please help me to find normal examples of coding with EBNF func or explain my mistake.
import sys
/expression = sys.argv[1]
.