parsing - Parse function, python (binary search tree) -


I am trying to implement a parsed function. "From an infix stream of tokens, and in the current index token stream, as a collection of nodes, the tree is built and returned, which represents the expression" It is that I have come so far:

Pars (lst, i + 1) correct, i = parse (lst, i + 1) if token.isdigit (): return mkLiteralNode (token) alifed token. Identifier (): Return mkVariableNode (token) Other: Left, I = parse (lst, i + 1) true, i = parse (lst, i + 1) returns true

In general, tokens.advertisement means that this command must return an integer, which is mkLiteralNode , and token. The identifier must return the variable, or mkVariableNode . I get an error when testing this function and the error occurs:

  token = lst [i] TypeError: 'int' object is not subscriptable   < P> How can I fix this?   

The error is correct in the previous row:

  lst = 0 < / Code>  

You are lst an int and then you are trying to access it as a list that is causing the error You may be looking at token = lst [i] :

  token = token [i]    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -