Language patterns in Python

25 views
Skip to first unread message

Larry Dingle

unread,
Jul 19, 2014, 11:52:34 AM7/19/14
to antlr-di...@googlegroups.com
Has anyone translated the symbol table patterns from LIP to Python? Seems like it should be pretty straight forward. My problem is trying to make sense of some of the Java -- most is obvious, but some is just chicken scratches. Can't decide which is worse, Java/C++ or APL.

Larry Dingle

unread,
Jul 20, 2014, 2:47:49 PM7/20/14
to antlr-di...@googlegroups.com

A specific example:

In Symbol Table for Monolithic Scope, class SymbolTable implements the interface Scope. Is that equivalent to Scope being an abstract base class of SymbolTable? Structurally it seems so because the only public methods, aside from the constructor and toString, are from Scope.


However, the “inherited” methods from Scope refer to the elements introduced by SymbolTable, but except for define, not the other way around. Functionally that seems to say that Scope has a SymbolTable, not SymbolTable is a Scope. Would it then be possible to turn the implementation around: make Scope the fundamental element, create a more simple SymbolTable class that only contains the HashMap (or equivalent), and move initTypeSystem and toString to Scope?


That seems to make more sense from a Python point of view. Am I missing something fundamental that invalidates this approach?


Aside: for those that never heard of APL, it was widely considered a write-only language consisting mostly of non-standard symbols. You either had to use a graphics terminal that could generate them, or bought a special wheel for your daisy-wheel printer. Chances were good you could not understand your own code in a few days, and someone else's –not bloody likely at all.


Reply all
Reply to author
Forward
0 new messages