Giter VIP home page Giter VIP logo

python-interpreter-assignment-2021's Introduction

内建函数

  • print
  • int
  • float
  • str
  • bool

表达式解析

  • file_input: (NEWLINE | stmt)* EOF;

  • funcdef: 'def' NAME parameters ':' suite;

  • parameters: '(' typedargslist? ')';

  • typedargslist: (tfpdef ('=' test)? (',' tfpdef ('=' test)?)*);

  • tfpdef: NAME ;

  • stmt: simple_stmt | compound_stmt;

  • simple_stmt: small_stmt NEWLINE;

  • small_stmt: expr_stmt | flow_stmt;

  • expr_stmt: testlist ( (augassign testlist) | ('=' testlist)*);

  • augassign: ('+=' | '-=' | '*=' | '/=' | '//=' | '%=' );

  • flow_stmt: break_stmt | continue_stmt | return_stmt;

  • break_stmt: 'break';

  • continue_stmt: 'continue';

  • return_stmt: 'return' (testlist)?;

  • compound_stmt: if_stmt | while_stmt | funcdef ;

  • if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ('else' ':' suite)?;

  • while_stmt: 'while' test ':' suite;

  • suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT;

  • test: or_test ;

  • or_test: and_test ('or' and_test)*;

  • and_test: not_test ('and' not_test)*;

  • not_test: 'not' not_test | comparison;

  • comparison: arith_expr (comp_op arith_expr)*;

  • comp_op: '<'|'>'|'=='|'>='|'<=' | '!=';

  • arith_expr: term (addorsub_op term)*;

  • addorsub_op: '+'|'-';

  • term: factor (muldivmod_op factor)*;

  • muldivmod_op: '*'|'/'|'//'|'%';

  • factor: ('+'|'-') factor | atom_expr;

  • atom_expr: atom trailer?;

  • trailer: '(' (arglist)? ')' ;

  • atom: (NAME | NUMBER | STRING+| 'None' | 'True' | 'False' | ('(' test ')'));

  • testlist: test (',' test)* (',')?;

  • arglist: argument (',' argument)* (',')?;

  • argument: ( test | test '=' test );

python-interpreter-assignment-2021's People

Contributors

jerx2y avatar

Stargazers

Eason Wang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.