On Fri, May 18, 2018, at 1:32 AM, Nikhil Pappu wrote:
> Ondřej, Jason,
> 
> I have written my first blog post <https://wp.me/p3Sr5x-2> discussing the 
> project details and status.
> Can you please go over it and provide feedback?

I think overall it looks very good. It looks like you got a good handle of 
ANTLR4.

I noticed you are using a listener:

https://github.com/NikhilPappu/autolev-parser/blob/f6d110ff5a8cef3aea4f6357f343491572350393/myListener.py#L260

In my codes, I ended up using a visitor --- since I needed to visit every node 
anyway, and recursively construct the, in your case, sympy expression probably.

One thing to consider is whether to directly use the grammar from ANTLR, which 
is called a concrete syntax tree (CST), and construct a sympy expression of 
whatever you want out of it directly. That is what you do now I think.

The alternative is to first construct an abstract syntax tree (AST) from the 
CST. That way the AST will be the input to the rest of your "compiler", and it 
won't matter that we currently use ANTLR to construct it. Later somebody can 
decide to write a hand parser, or some other tool. As long as it produces the 
AST, that's all that matters. 

As it is currently, the CST depends on the exact rules as you write them in the 
ANTLR grammar, and everytime you change the rules, you have to rework your 
compiler. While if you use AST, then you only have to modify the code that 
converts the (modified) CST to AST, but that's it. The rest of the compiler 
uses AST, and so it doesn't need to change. Python, for example, uses this 
approach. It parses Python code into an AST, and so they are free to change the 
parser any way they like ---- our SymPy code that uses the Python AST doesn't 
need to change.


> Also, when will you be available to discuss things?

I am available over email only the next week.

Ondrej

> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/bc81cd14-ad9b-4503-a639-aa6f673f4c51%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/1526639904.177921.1376625912.09CA91C7%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to