Open rebcabin opened 1 year ago
This is how we print symbols: we print the number and then the symbol name.
We could print it using some other notation, say:
[(SubroutineCall ; head, term: stmt
(1
main0) ; symbol nym
() ; symbol ? original-nym
[] ; call_arg * args
()) ; expr ? dt
]
If you can come up with a more natural printing, that would be great. Thanks for reviewing this!
definitely need to pair the symbol-table-id with the name in brackets, not have implicit grouping. {main0 1}
would be best for Clojure because symbols in clojure act like dictionary lookup keys. {main0 1}
is a singleton dictionary in Clojure.* Either the dictionary or a symbol (appropriately quoted) act like functions; the following illustrates many ways to look up the 1
from the main0
:
user=> {'main0 1}
{main0 1}
user=> ({'main0 1} 'main0)
1
user=> '{main0 1}
{main0 1}
user=> ('{main0 1} 'main0)
1
user=> ('main0 '{main0 1})
1
user=> ('main0 {'main0 1})
1
The meaning here is "what symbol-table am I in (by id number)."
map
function and isn't a great choice. I'll say "dictionary" and they can say "map."{main0 1}
is fine. How does Clojure know where to lookup main0
using the integer 1
?
lpython expr2.py --show-asr --no-color
prints the following (edited)But the ASR has no term for the first element, 1:
I assume
1
is a symbol-table ID, but the shape mis-match leads me to believe there is a bug.