fstep-0.2.0


توضیحات

python mock up pku-minic/first-step
ویژگی مقدار
سیستم عامل OS Independent
نام فایل fstep-0.2.0
نام fstep
نسخه کتابخانه 0.2.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده jiang hongyong
ایمیل نویسنده hongyong_jiang@hotmail.com
آدرس صفحه اصلی https://github.com/allegrofb/fstep
آدرس اینترنتی https://pypi.org/project/fstep/
مجوز MIT
# fstep This is my learning python project, mock up [pku-minic/first-step](https://github.com/pku-minic/first-step) with python. ## instal ``` $ pip install fstep ``` ## example ```first-step # calculate the nth term of the Fibonacci sequence fib(n) { if n <= 2 { return 1 } else { return fib(n - 1) + fib(n - 2) } } main() { print(fib(input())) return 0 } ``` You can evaluate this program using the interpreter by running: ``` $ fstep -s examples/fib.fstep -i 20 6765 0 ``` Or compile it to RISC-V assembly: ``` $ fstep -s examples/fib.fstep -a ``` ## EBNF of first-step ```ebnf Program ::= {FunctionDef}; FunctionDef ::= IDENT "(" [ArgsDef] ")" Block; ArgsDef ::= IDENT {"," IDENT}; Block ::= "{" {Statement} "}"; Statement ::= IDENT ":=" Expression | IDENT "=" Expression | FunctionCall | IfElse | "return" Expression; IfElse ::= "if" Expression Block ["else" (IfElse | Block)]; Expression ::= LOrExpr; LOrExpr ::= LAndExpr {"||" LAndExpr}; LAndExpr ::= EqExpr {"&&" EqExpr}; EqExpr ::= RelExpr {("==" | "!=") RelExpr}; RelExpr ::= AddExpr {("<" | "<=") AddExpr}; AddExpr ::= MulExpr {("+" | "-") MulExpr}; MulExpr ::= UnaryExpr {("*" | "/" | "%") UnaryExpr}; UnaryExpr ::= ["-" | "!"] Value; Value ::= INTEGER | IDENT | FunctionCall | "(" Expression ")"; FunctionCall ::= IDENT "(" [Args] ")"; Args ::= Expression {"," Expression}; ```


زبان مورد نیاز

مقدار نام
>=3.7 Python


نحوه نصب


نصب پکیج whl fstep-0.2.0:

    pip install fstep-0.2.0.whl


نصب پکیج tar.gz fstep-0.2.0:

    pip install fstep-0.2.0.tar.gz