abstract-syntax-tree Questions
1
Solved
I was looking at the vec![] macro implementation in Rust and noticed it uses the __rust_force_expr! macro. This is the implementation of the latter:
/// Force AST node to an expression to improve d...
Halden asked 18/12, 2021 at 10:9
1
Solved
I finished converting the ANTLR CST into an AST and created a specific Visitor<T> interface that allows me to visit all my AST nodes, but the main issue i'm having is that some visits should ...
Creatural asked 4/12, 2021 at 10:14
5
Solved
I'm making an interpreter in C++, so far I've got my lexer to generate tokens. The problem is I'm not sure how to generate an "walk" a parse tree.
I was thinking of making my parse tree using an a...
Quarterstaff asked 15/2, 2015 at 19:39
1
Solved
VS Code has a 'Convert namespace import to named imports' refactoring. As far as I understand, the refactoring is defined in the Typescript codebase itself, so it's not specific to VS Code.
I need ...
Alwin asked 22/10, 2021 at 8:30
4
Solved
I have an expression described in variable forms like this
's1*3 - (s2-s1)*1'
I have given values of s1 and s2 that can change according to the need
I can use python ast module to evaluate this ex...
Luxurious asked 16/10, 2014 at 7:6
2
Solved
I've attempted to make multiple assignments with the walrus operator, and seen questions on StackOverflow such as this which also fail to assign multiple variables using a walrus operator, and am j...
Expectoration asked 2/1, 2020 at 16:59
4
Solved
I want to use the Rust parser (libsyntax) to parse a Rust file and extract information like function names out of it. I started digging in the docs and code, so my first goal is a program that prin...
Bear asked 26/10, 2014 at 16:51
1
I want to index all methods and thee connections between them in an entire application (A directory with sub directories and files eventually). I'm using ast, looping over directories till individu...
Bromic asked 21/8, 2018 at 18:54
4
Solved
I'm working with Abstract Syntax Trees in Python 3. The ast library gives many ways to get children of the node (you can use iter_child_nodes() or walk()) but no ways to get parent of one. Also, ev...
Uncommitted asked 2/1, 2016 at 21:38
6
Solved
I have a situation with some code where eval() came up as a possible solution. Now I have never had to use eval() before but, I have come across plenty of information about the potential danger it ...
Huntington asked 4/3, 2013 at 8:50
3
Solved
Suppose I have the following string:
code = """
if 1 == 1 and 2 == 2 and 3 == 3:
test = 1
"""
The following code converts that string in a AST.
ast.parse(code)
Then I have a tree like:
Modu...
Pouter asked 13/10, 2016 at 20:4
1
I'am using ANTLR4 to generate Abstract Syntax Tree (AST) for PL/SQL codes. For some queries it works fine, but for some codes it generates an AST with only one node which is not right.
For example...
Tully asked 17/12, 2015 at 12:21
1
Solved
I wrote a parser and evaluator for a simple programming language. Here is a simplified version of the types for the AST:
data Value = IntV Int | FloatV Float | BoolV Bool
data Expr = IfE Value [Exp...
Mcauliffe asked 18/4, 2021 at 1:2
4
Not sure of the terminology here, but this would be difference between eq? and equal? in scheme, or the difference between == and strncmp with C strings; where in each case the first would return f...
Lenoralenore asked 22/7, 2010 at 20:11
4
What is an AST transformation in general? I came across these words when reading Groovy blog's. But what it is in general?
Raleigh asked 4/6, 2011 at 6:7
4
Solved
Python AST nodes have lineno and col_offset attributes, which indicate the beginning of respective code range. Is there an easy way to get also the end of the code range? A 3rd party library?
Jermaine asked 25/5, 2013 at 9:7
1
Solved
I have a big project, and a slew of C++ class member functions of the form:
Return CClass::MemberFunction(
Arg1 arg1,
//...
std::weak_ptr<IMemberFunctionListenerInterface> listener) {
//.....
Sharondasharos asked 1/3, 2021 at 20:28
2
How can I access alternate labels in ANTLR4 while generically traversing a parse tree? Or alternatively, is there any way of replicating the functionality of the ^ operator of ANTLR3, as that would...
Precondition asked 15/10, 2013 at 3:45
1
Solved
What is the ctx argument in the Python AST representation? For example:
>>> print(ast.dump(ast.parse('-a')))
Module(body=[Expr(value=UnaryOp(op=USub(), operand=Name(id='a', ctx=Load())))])...
Daphne asked 14/1, 2021 at 23:22
3
Solved
I read here the following example:
>>> def double_inputs():
... while True: # Line 1
... x = yield # Line 2
... yield x * 2 # Line 3
...
>>> gen = double_inputs()
>>> ne...
Alidaalidade asked 6/5, 2020 at 22:13
2
Solved
Are there any docs / examples of writing a Typescript plugin?
For the last time I am very inspired with the idea of bringing Typescript into my projects. However, currently I see this is not pos...
Etherify asked 9/11, 2016 at 17:53
4
Solved
Using Go’s ast package, I am looping over a struct’s field list like so:
type Thing struct {
Field1 string
Field2 []int
Field3 map[byte]float64
}
// typ is a *ast.StructType representing the a...
Kekkonen asked 27/11, 2013 at 5:7
3
I'm on Windows, using MSVC to compile my project, but I need clang for its neat AST parser, which allow me to write a little code generator.
Problem is, clang cannot parse MSVC headers (a very-well...
Ximenes asked 7/10, 2015 at 13:34
2
Solved
After I read the Using the Compiler API article, I could get the AST from string-code.
But when I try to generate the code (by escodegen) from AST (not transpile it) to code I got an error:
Unknown...
Lemon asked 9/12, 2020 at 9:23
3
I'm using clang to do some analysis and I need to find parent of a declaration in AST. For instance, in the following code I have int x and I want to get its parent which should be the function dec...
Worktable asked 5/12, 2014 at 4:17
© 2022 - 2024 — McMap. All rights reserved.