abstract-syntax-tree Questions
3
Solved
I'd like to implement annotation processor that will generate new class based on existing "prototype" class.
import java.util.List
@MyAnnotation
class MySuperClassPrototype {
static MySuperClass...
Doorn asked 5/12, 2011 at 15:17
1
Solved
I had an idea to transform all given functions that are tagged using a decorator similar to the below,
@transform_ast
def foo(x):
return x
In transform_ast, I get the source, extract the ast, ...
Jesher asked 13/8, 2019 at 14:53
2
Solved
Suppose I used language-javascript library to build AST in Haskell. The AST has nodes of different types, and each node can have fields of those different types.
And each type can have numerous con...
Akkadian asked 3/8, 2019 at 6:37
2
Solved
Is there anything in Julia which is equivalent to Python's literal_eval provided by the package ast (Abstract Syntax Tree)?
A summary of its (literal_eval) description:
This function only evalu...
Morrissette asked 26/5, 2017 at 6:24
0
I want my extension to be able to read the Java AST of a .java file to further save the Node name (for instance, "ClassDeclaration") of a selected piece of code. For example if you select "public",...
Margret asked 12/3, 2019 at 10:41
1
In the following code, I was able get the first annotation object "Publishable", but not the second. The 2nd one used named arguments, which translated to x$2, x$3, x$1 as arguments in the AST. How...
Proclamation asked 6/3, 2019 at 21:9
2
Are there any known ways for ast.literal_eval(node_or_string)'s evaluation to not actually be safe?
If yes, are patches available for them?
(I already know about PyPy[sandbox], which is presumabl...
Ralaigh asked 17/1, 2011 at 5:24
1
Solved
I've created a tree dump how described here: How can I dump an abstract syntax tree generated by gcc into a .dot file? for this dummy script:
int fact(int n) {
if (n<=1) {
return 1;
}
retur...
Idou asked 12/1, 2019 at 19:3
3
Solved
Let's say, I have a bunch of functions a, b, c, d and e and I want to find out if they directly use a loop:
def a():
for i in range(3):
print(i**2)
def b():
i = 0
while i < 3:
print(i**2)...
Paleoclimatology asked 8/1, 2019 at 13:28
2
Solved
I think the question's title is self-explanatory, I want to dump an abstract syntax tree generated by gcc into a .dot file (Those files generated by Graphviz) because then I want to view it in a .p...
Orff asked 3/4, 2013 at 23:50
0
This comes from this issue in the Perl 6 documentation, on the differential treatment of colonpairs; while :a is equivalent to a => True, (:a:b) is (a => True b => 1) and :a:b or :a :b sim...
Diabolo asked 5/1, 2019 at 9:19
3
Solved
How can I find if an attribute is synthesized or inherited from the productions of a grammar?
I guess for that the attribute must be predefined in the problem -- if its value depends on child or p...
Ratafia asked 11/4, 2015 at 10:35
2
Solved
Can I add a prefix and suffix to the source code of functions?
I know about decorators and do not want to use them (the minimal example below doesn't make clear why, but I have my reasons).
def f...
Merrilee asked 16/12, 2018 at 12:35
1
Solved
This is related to this question on accesing the POD, but it goes further than that. You can easily access the Abstract Syntax Tree of a Perl 6 program using:
perl6 --target=ast -e '"Þor is mighty...
Cribble asked 17/12, 2018 at 9:51
3
Solved
Let's say, I have a bunch of functions a, b, c, d and e and I want to find out if they call any method from the random module:
def a():
pass
def b():
import random
def c():
import random
ran...
Familiarize asked 16/12, 2018 at 0:51
2
Solved
I have been working through the Advent of Code problems in Perl6 this year and was attempting to use a grammar to parse the Day 3's input.
Given input in this form: #1 @ 1,3: 4x4 and this grammar...
Nickey asked 10/12, 2018 at 18:12
2
Solved
I'm starting a new project, and as part of its interface we have a whole bunch of "tokens", a recursive object with string values, like so:
const colors = {
accent: '#f90',
primary: {
active: '...
Shon asked 9/11, 2018 at 8:37
2
import ast
code = '1+1'
expr = ast.parse(code).body[0]
print(type(expr))
compile(ast.Expression(expr), 'string', "eval")
gets me
class '_ast.Expr'
Traceback (most recent call last):
Fi...
Idell asked 15/10, 2018 at 15:24
1
Solved
I am trying to build a mini Bash interpreter in C without the help of any fancy library (i.e from scratch). I have to manage simple operators like '<', '|', '<<', '>>', '>'.
I am told to b...
Alkane asked 5/10, 2018 at 13:16
1
Solved
In the Hibernate 6.0 Roadmap (https://github.com/hibernate/hibernate-orm/wiki/Roadmap6.0) SQM is mentioned as upcoming.
What is SQM?
In this roadmap the following short words describe it:
SQM...
Terzetto asked 26/9, 2018 at 13:32
1
Solved
Does anyone know why this works in MATLAB?
>> 1 ++ 2
ans =
3
Coming from coding in C, python, Java etc, I find it most counterintuitive that this should work at all. Presumably there's so...
Cephalothorax asked 28/9, 2018 at 12:47
1
Consider the following interface:
interface X {
x: string
}
I'm trying to use the typescript compiler API to get property x's type. Here's what I have so far:
import {
PropertySignature,
...
Flamsteed asked 26/9, 2018 at 15:13
2
Solved
Recently, I started learning how to build webpack plugins. I'm trying to build a plugin that will update my source code.
The rules are simple:
If the entry point name has less than 2 as, I have ...
Doublet asked 23/9, 2018 at 12:1
2
Solved
I am looking for a language parser written in PHP.
The goal is to read a custom language, not read PHP code.
Basically, I want to specify a language syntax, give a code snippet and get back a str...
Acerate asked 5/5, 2013 at 17:45
6
Solved
I have an AST derived from the ANTLR Parser Generator for Java. What I want to do is somehow construct a control flow graph of the source code, where each statement or expression is a unique Node. ...
Dosi asked 18/9, 2008 at 13:30
© 2022 - 2024 — McMap. All rights reserved.