Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'If' statements fail to generate with error about split() #32

Closed
davidhoward opened this issue Apr 24, 2012 · 1 comment
Closed

'If' statements fail to generate with error about split() #32

davidhoward opened this issue Apr 24, 2012 · 1 comment

Comments

@davidhoward
Copy link

Cgen seems to expect the Compare AST element to possess a split() method, which it does not. This makes translation of meaningful branches difficult. Minimal code to produce such an error is reproduced below:

import asp.codegen.ast_tools as ast_tools
import asp.codegen.cpp_ast as cpp_ast
import inspect, ast

def if_test( x ):
    if x != 0:
        return x
    else:
        return 0

if __name__ == '__main__':
    if_src = inspect.getsource( if_test )
    if_ast = ast.parse( if_src.lstrip() )
    nt = ast_tools.ConvertAST()
    c_src = str( nt.visit( if_ast ) )
    print c_src

The error is thrown at line 473 of cgen/init.py.

@shoaibkamil
Copy link
Owner

Fixed with commit 5788be1. The issue is a bug in cgen that we'll have to work around for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants