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

Do you use CSTs or ASTs? #22

Open
brando90 opened this issue Dec 22, 2021 · 5 comments
Open

Do you use CSTs or ASTs? #22

brando90 opened this issue Dec 22, 2021 · 5 comments

Comments

@brando90
Copy link

From the description of terminal and non-terminals I'd assume a CST but you call it ASTs. Can you clarify this?

Concrete Syntax Tree vs Abstract Syntax Tree. The latter usually has constructors instead of terminal/non-terminals...

@zysszy
Copy link
Owner

zysszy commented Dec 24, 2021

We use Abstract Syntax Tree (AST). In this tree, all leaf nodes are terminals and other nodes are non-terminals.

@brando90
Copy link
Author

brando90 commented Dec 24, 2021

We use Abstract Syntax Tree (AST). In this tree, all leaf nodes are terminals and other nodes are non-terminals.

Not sure what you mean by terminals and non-terminals if you are using ASTs. My understanding is if those are symbols from the grammar then you are using a CST.

If you were using ASTs then you only have programming language constructs at each level. e.g. consider this lambda calc expression

λ x. x+x

That could be represented by the AST:

Abs(Var(x), Add(Var(x), Var(x)))

in this tree there are no terminals and non-terminals.

So for python you would have things like If( ) else () etc.

@zysszy
Copy link
Owner

zysszy commented Jan 8, 2022

We use Abstract Syntax Tree (AST). In this tree, all leaf nodes are terminals and other nodes are non-terminals.

Not sure what you mean by terminals and non-terminals if you are using ASTs. My understanding is if those are symbols from the grammar then you are using a CST.

If you were using ASTs then you only have programming language constructs at each level. e.g. consider this lambda calc expression

λ x. x+x

That could be represented by the AST:

Abs(Var(x), Add(Var(x), Var(x)))

in this tree there are no terminals and non-terminals.

So for python you would have things like If( ) else () etc.

Sorry for late reply.

In our paper, all leaf nodes are terminals. Thus, all x in Abs(Var(x), Add(Var(x), Var(x))) are terminals and other nodes are non-terminals.

@brando90
Copy link
Author

brando90 commented Jan 8, 2022 via email

@zysszy
Copy link
Owner

zysszy commented Jan 13, 2022

We use the python lib ast to directly parse the AST.

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