Skip to content

Move colons to the front of symbols in symbol table #1420

@rebcabin

Description

@rebcabin

Consider

./src/bin/lpython -I/Users/brian/Documents/GitHub/lpython/src/runtime/ltypes/ltypes.py --show-asr --no-color ./examples/expr2.py   
(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 4 {}) _lpython_main_program [main0] [] [(SubroutineCall 1 main0 () [] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main0: (Function (SymbolTable 2 {x: (Variable 2 x [] Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [] [(= (Var 2 x) (IntegerBinOp (IntegerBinOp (IntegerConstant 2 (Integer 4 [])) Add (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant 5 (Integer 4 []))) Mul (IntegerConstant 5 (Integer 4 [])) (Integer 4 []) (IntegerConstant 25 (Integer 4 []))) ()) (Print () [(Var 2 x)] () ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main_program: (Program (SymbolTable 3 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())])}) [])

I'm writing some back ends in Clojure. something like _lpython_main_program: is a syntax error in Clojure. If you move the colon to the front :_lpython_main_program, then, magically, ASR becomes valid Clojure, no post-processing needed! Otherwise I have to postprocess the output of --show-asr in non-robust string-hacking in Clojure.

Please consider permanently moving the colons to the front of symbols in --show-asr. You can change one line of code in PickleVisitorVisitor to do this forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    asrASR related changesbugSomething isn't workingeasy to fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions