Closed khei4 closed 3 years ago
似たような多項式のを書いたから多分一瞬
expr := term, ( ( '+' | '-' ), term)*; term := factor ( ( '*' | '/' ), factor)*; factor := unary ( '^' unary )*; unary := ( '+' | '-' )* ( func | primary ); func := "cos" '(' expr ')' | "sin" '(' expr ')' | "tan" '(' expr ')' | "log" '(' expr ')' | "exp" '(' expr ')'; primary := number | var | '(' expr ')' ; number := ( "1" | "2" | ... | "9" ) digit*; var := letter ( letter | digit )*; letter = ("a" | "b" | ... | "z" | "A" | ... | "Z"); digit = "0" | "1" | "2" | ... | "9";
結局変数は出現するのを管理する必要ありそうね
テストを書く
似たような多項式のを書いたから多分一瞬