Erlang & ASN.1(Abstract Syntax Notation One) medium.com/erlang-battleg…
πŸ‘︎ 15
πŸ’¬︎
πŸ‘€︎ u/elbrujohalcon
πŸ“…︎ Dec 21 2021
🚨︎ report
Erlang & ASN.1(Abstract Syntax Notation One) medium.com/erlang-battleg…
πŸ‘︎ 23
πŸ’¬︎
πŸ‘€︎ u/elbrujohalcon
πŸ“…︎ Dec 21 2021
🚨︎ report
Is there a good book for learning both the language of proofs, ie the notation, syntax and all that. And also explains the logic and reasoning.

My school doesn't offer any proof based linear algebra courses so i thought id try to read one on my own.

πŸ‘︎ 23
πŸ’¬︎
πŸ‘€︎ u/Poacatat
πŸ“…︎ Dec 14 2021
🚨︎ report
My latest Python project: a tool for visualising Python Abstract Syntax Trees

I've been playing with this idea for a while now, creating a tool to visualise the AST of a given script. I decided the other day to take the prototype I've been using, add some finishing touches, and release it as a PyPI package. Essentially: you pass it a filepath, and it generates an AST (using Python's in-built "ast" module) of that file, and then draws that tree as a graph. It can also draw graphs of ASTs you create using the ast module. The graphs are built using networkx and matplotlib.

An example graph.

It's still rather rough around the edges. I've only been using Python casually for a couple of years, and this is the first time I've released a PyPI package - but I'm open to feedback!

Link to the source code: https://github.com/JamesPhillipsUK/vast

πŸ‘︎ 45
πŸ’¬︎
πŸ‘€︎ u/ThatJessePerson
πŸ“…︎ Dec 31 2021
🚨︎ report
Jello v1.3 now supports dot notation (Command-line JSON filter using python syntax)

I'm happy to announce that jello now supports dot notation in v1.3:

$ echo '{"foo": {"bar": [1, 2, 3]}}' | jello _.foo.bar
[
  1,
  2,
  3
]

jello is like jq, except you can use standard python syntax to filter the JSON. jello removes all of the boilerplate code you would have to add so you can now easily filter JSON within BASH scripts without learning arcane jq syntax.

Here's an example:

$ jc -a | jello -lr '[entry.name for entry in _.parsers if "darwin" in entry.compatible]'
airport
airport_s
arp
...

Try it out with the web demo: https://jello-web-demo.herokuapp.com/

Here's the github: https://github.com/kellyjonbrazil/jello

πŸ‘︎ 19
πŸ’¬︎
πŸ‘€︎ u/kellyjonbrazil
πŸ“…︎ Jun 09 2021
🚨︎ report
Formal Metatheory of Second-Order Abstract Syntax cl.cam.ac.uk/~ds709/agda-…
πŸ‘︎ 16
πŸ’¬︎
πŸ‘€︎ u/gallais
πŸ“…︎ Nov 19 2021
🚨︎ report
Better tooling to build widgets - Glance abstracts RemoteViews with Compose syntax youtu.be/15Q7xqxBGG0?t=55…
πŸ‘︎ 14
πŸ’¬︎
πŸ‘€︎ u/justasm
πŸ“…︎ Nov 01 2021
🚨︎ report
Typing an Abstract Syntax Tree

Hi, I'm building a C compiler in TypeScript.

Picked typescript because I was new to compilers and wanted a language that was flexible and I was already comfortable in.

When writing the types for an Abstract Syntax Tree, I am finding it very hard to do the arithmetic portion of the language. I am basing that on this EBNF grammar definition (from Nora Sandler's excelent blog on building a C compiler)

<exp> ::= <term> { ("+" | "-") <term> }
<term> ::= <factor> { ("*" | "/") <factor> }
<factor> ::= "(" <exp> ")" | <unary_op> <factor> | <int>

My type definitions for the grammar described above:


type TExpression = {
  left: TExpression,
  operator: "-" | "+",
  right :TExpression,
} | TTerm


type TTerm  = {
  left: TTerm ,
  operator: "\*" | "/",
  right: TTerm
} | TFactor


type TFactor = TValue | TUnaryOperation|TExpression;

type TValue = number | string

type TUnaryOperation = {
  operator: "!" | "~" | "-",
  operand: TFactor
}



As one might expect, I get an error: "TFactor circularly references itself"

This happens, I reckon, because TypeScript does not handle self referencing types like for example OCaml does. Since TFactor can be a TExpression, but TExpression can also be TFactor, this problem arises.

The (rather ugly) way I fixed this issue was:


export type TFactor =  {
  factor: TValue | TUnaryOperation|TExpression 
}  

This solves the error, but is very clunky and makes it bothersome to handle in the latter stages of the compilation process. For example: The expected AST for the arithmetic operation "2*(1+1)" is

{
  left: "2",
  operator: "*",
  right: {
    left: "1",
    operator:"+",
    right: "1",
  }
}

What I get with my solution:

{
  left: {
    factor: "2"
  },
  operator: "*",
  right: {
    factor:{
      left: {factor: "1"},
      operator: "+",
      right: {factor: "1"}
    }
  }
}

I can easily get rid of this issue by post processing the AST and fixing it up by removing the "factor" attributes and append any child attributes there. However, I wondered if it was possible to solve this problem some other way with more clever types.

So, my question is: is there any legit way to solve the error I was getting by using some typescript feature I am not aware of, or by re-i

... keep reading on reddit ➑

πŸ‘︎ 25
πŸ’¬︎
πŸ‘€︎ u/machoLatino45
πŸ“…︎ Aug 30 2021
🚨︎ report
Abstract Syntax Trees

I am currently learning about parsing and I keep hearing the term "Abstract Syntax Tree". I know what it is by definition but I'm not sure how it's generated. Is it translated from a concrete syntax tree or is it generated directly by some parsing algorithm, i.e. recursive descent, SLR, etc? Any resources would be helpful, thanks!

πŸ‘︎ 16
πŸ’¬︎
πŸ“…︎ Jul 29 2021
🚨︎ report
R now provides a simple native pipe syntax β€˜|>’ as well as a shorthand notation for creating functions, e.g. β€˜\(x) x + 1’ is parsed as β€˜function(x) x + 1’. The pipe implementation as a syntax transformation was motivated by suggestions from Jim Hester and Lionel Henry. (experimental) developer.r-project.org/b…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/nfultz
πŸ“…︎ Dec 06 2020
🚨︎ report
Why do template engines create Abstract Syntax Tree (AST) objects when compiling to HTML instead of parsing the document and string-manipulating its content to generate HTML?

EDIT: I think I got the answer for the question. The use case for template engines is more complicated than I initially thought.

Sorry if this is a stupid question, but I was looking into source code of some template engines. It seems that the general approach is to parse the document and create an Abstract Syntax Tree (AST) object, which would then be used to generate the HTML.

It made me wonder why it's necessary to do that instead of parsing the document, and doing string manipulation to generate the HTML? Is this really stupid and I'm missing something very clear?

Suppose we look at mustache.js anyways (assuming it works the same; I didn't look at their source code). Parsing the document and detecting {{ would invoke a function that replaces the variable with the content that should be there.

If we look at pug, the beginning of the line is a tag name, so I would turn that into a tag name <div> for example, and append </div> where it ends. It will probably be a recursive function to take care of the nesting, but it still seems easier than the AST approach.

Is there a major flaw in the approach I am thinking of that would make it go wrong? Or cause big performance issues?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/oxamide96
πŸ“…︎ Aug 02 2021
🚨︎ report
Abstract Syntax Tree (AST) in Java oraclejavacertified.blogs…
πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Aug 16 2021
🚨︎ report
RON Mode Syntax highlighting for Rusty Object Notation (RON) codeberg.org/Hutzdog/ron-…
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/negativeoilprice
πŸ“…︎ Aug 24 2020
🚨︎ report
How to Replace Single Node with Two Nodes in Abstract Syntax Tree? tomasvotruba.com/blog/how…
πŸ‘︎ 13
πŸ’¬︎
πŸ‘€︎ u/Tomas_Votruba
πŸ“…︎ Jul 09 2021
🚨︎ report
Merklized Abstract Syntax Tree - Compress a Smart Contract Logarithmically link.medium.com/zmcgT5Nqk…
πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/Knockout_SS
πŸ“…︎ Jul 31 2021
🚨︎ report
Recommended way to build an abstract syntax tree?

After lexing the source, what's the recommended way to build a abstract syntax tree? I hear "use bison" or a descent parser the most. Are those the two most recommended ways? I didn't like bison generation and I haven't tried writing a descent parser

πŸ‘︎ 14
πŸ’¬︎
πŸ“…︎ Mar 31 2021
🚨︎ report
Can one write the intermediate language directly as text or is there some reason to construct an abstract syntax tree for the intermediate language representation as well?

Can one write the intermediate language directly as text or is there some reason to construct an abstract syntax tree for the intermediate language representation as well?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/mavavilj
πŸ“…︎ May 07 2017
🚨︎ report
Of function instances and abstract syntax

Some Haskell classes class Myclass a admit an instance for functions instance Myclass a =&gt; Myclass (x -&gt; a) based on the instance for a. All of these instances have a few things in common: (1) they implement the class methods in a straightforward way as mymethod f = \x -&gt; mymethod (f x), and (2) they are polarizing among Haskell practitioners. The linked blog post is a case study of why I find such instances compelling and useful.

https://www.danielbrice.net/blog/of-function-instances-and-abstract-syntax/

Edit: I'm told there's something wonky about markdown links on mobile.

Here's a fixed link: fixed link.

Here's the plain-text URL: https://www.danielbrice.net/blog/of-function-instances-and-abstract-syntax/

πŸ‘︎ 14
πŸ’¬︎
πŸ‘€︎ u/friedbrice
πŸ“…︎ Apr 21 2021
🚨︎ report
How to delete abstract syntax tree?

I'm experimenting with polymorphism:

class node
{
};

class node_number : public node
{
public:
    node_number(int a): a(a){}
private:
    int a;
};

class node_binary_operation : public node
{
public:
    node_binary_operation(node&amp; left, token operation, node&amp; right)
    :left(&amp;left), operation(operation), right(&amp;right) {}

    ~node_binary()
    {
        delete left;
        delete right;
    }
private:
    node* left;
    token operation;
    node* right;
};

I'm concerned about the destructor. I don't know if it will just delete pointers and not pointers inside those pointers, and so on (I don't want any unnecessary recursion). Will this code work? How shall I improve this. I'm new to polymorphism.

Also, am I right to pass left and right nodes by reference in the constructor?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Yuveno
πŸ“…︎ Apr 30 2021
🚨︎ report
Extracting the abstract syntax tree from GCC [LWN.net] (2015) lwn.net/Articles/629259/
πŸ‘︎ 18
πŸ’¬︎
πŸ‘€︎ u/laqq3
πŸ“…︎ Mar 27 2021
🚨︎ report
Do notation syntax is probably a rip-off from Perl

While looking at nofib's runstdtest.pl today, I had to squint really hard to see that that script isn't actually generating Haskell code but uses proper Perl syntax.

Note how that's exactly the style of do-notation (explicit braces + semicolons) SPJ prefers.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/sgraf812
πŸ“…︎ Sep 27 2019
🚨︎ report
Abstract Syntax Tree for Patching Code and Assessing Code Quality engineering.soroco.com/ab…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/pmz
πŸ“…︎ Jun 07 2021
🚨︎ report
Grant’s video on Abstract vector spaces was super helpful, but I’m still fuzzy on inner products and the notation <f|g> or <f,g>. Do you have any recommendations where I can learn more about these concepts?

Thank you for your time and any recommendations you may have. Additionally, Grant, thank you for clearing up the concept of Function spaces.

πŸ‘︎ 39
πŸ’¬︎
πŸ‘€︎ u/IsXp
πŸ“…︎ Nov 04 2020
🚨︎ report
Which grammar rules should be part of the abstract syntax tree and which should not?

When creating an AST which kinds of rules should be part of the tree and which should not?

Also if someone could briefly explain how is the symbol table and the AST related I would be glad.

πŸ‘︎ 4
πŸ’¬︎
πŸ“…︎ May 14 2021
🚨︎ report
For at least one day of the year Geordie has a preferred notation
πŸ‘︎ 307
πŸ’¬︎
πŸ“…︎ Dec 25 2021
🚨︎ report
Where is colon-postfixed notation for method call syntax documented in the official docs?

For example, Cro uses the syntax in this example:

my Cro::Service $hello = Cro::HTTP::Server.new:  # use colon instead of parens
    :host&lt;localhost&gt;, :port&lt;10000&gt;, :$application;

I found that the official docs also use this syntax, for example,

but couldn't find any explanations for the syntax.

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/nmtake
πŸ“…︎ Sep 07 2019
🚨︎ report
That struggle when most of the music industry uses one from of music notation and you use the other one
πŸ‘︎ 252
πŸ’¬︎
πŸ‘€︎ u/HeQiulin
πŸ“…︎ Dec 20 2021
🚨︎ report
I need grep for Java abstract syntax tree

I need to do refactoring legacy web system written by Java. This system is made of 10 million lines of Java code which is not well structured. For example,

if (requestType == 1) {
    doSometing1
} else if (requestType == 2) {
    doSometing2
} else {
    doSometing3
}

if (requestType == 1) {
    doSometing4
} else if (requestType == 2) {
    doSometing5
} else {
    doSometing6
}

Typically, there are 100 of boilerplate codes like this in a method. I want to know which procedures are called when request type is 1 simpler. grep is not enough powerful in this use. I need grep for abstract syntax tree like this.

gasp "if (requestType == 1) {/**/}" code.java
  doSomething1
  doSomething4

gasp stands for global search for abstract syntax tree and print. This command takes Java code as the first argument, and do pattern match. /**/ in your first argument matches code block.

I think if such command is exists, it will be really useful for many many use. I searched if there exists such tools, however, I could not find. So I am starting to create this command. Do you have any comments or requests? If you have ideas of alternative solutions, please let me know.

πŸ‘︎ 17
πŸ’¬︎
πŸ‘€︎ u/hoge2
πŸ“…︎ Dec 24 2020
🚨︎ report
Jello v1.3 now supports dot notation (Command-line JSON filter using python syntax)

I'm happy to announce that jello now supports dot notation in v1.3:

$ echo '{"foo": {"bar": [1, 2, 3]}}' | jello _.foo.bar
[
  1,
  2,
  3
]

jello is like jq, except you can use standard python syntax to filter the JSON. jello removes all of the boilerplate code you would have to add so you can now easily filter JSON within BASH scripts without learning arcane jq syntax.

Here's an example:

$ jc -a | jello -lr '[entry.name for entry in _.parsers if "darwin" in entry.compatible]'
airport
airport_s
arp
...

Try it out with the web demo: https://jello-web-demo.herokuapp.com/

Here's the github: https://github.com/kellyjonbrazil/jello

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/kellyjonbrazil
πŸ“…︎ Jun 09 2021
🚨︎ report
Jello v1.3 now supports dot notation (Command-line JSON filter using python syntax)

I'm happy to announce that jello now supports dot notation in v1.3:

$ echo '{"foo": {"bar": [1, 2, 3]}}' | jello _.foo.bar
[
  1,
  2,
  3
]

jello is like jq, except you can use standard python syntax to filter the JSON. jello removes all of the boilerplate code you would have to add so you can now easily filter JSON within BASH scripts without learning arcane jq syntax.

Here's an example:

$ jc -a | jello -lr '[entry.name for entry in _.parsers if "darwin" in entry.compatible]'
airport
airport_s
arp
...

Try it out with the web demo: https://jello-web-demo.herokuapp.com/

Here's the github: https://github.com/kellyjonbrazil/jello

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/kellyjonbrazil
πŸ“…︎ Jun 09 2021
🚨︎ report
Jello v1.3 now supports dot notation (Command-line JSON filter using python syntax)

I'm happy to announce that jello now supports dot notation in v1.3:

$ echo '{"foo": {"bar": [1, 2, 3]}}' | jello _.foo.bar
[
  1,
  2,
  3
]

jello is like jq, except you can use standard python syntax to filter the JSON. jello removes all of the boilerplate code you would have to add so you can now easily filter JSON within BASH scripts without learning arcane jq syntax.

Here's an example:

$ jc -a | jello -lr '[entry.name for entry in _.parsers if "darwin" in entry.compatible]'
airport
airport_s
arp
...

Try it out with the web demo: https://jello-web-demo.herokuapp.com/

Here's the github: https://github.com/kellyjonbrazil/jello

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/kellyjonbrazil
πŸ“…︎ Jun 09 2021
🚨︎ report
Jello v1.3 now supports dot notation (Command-line JSON filter using python syntax)

I'm happy to announce that jello now supports dot notation in v1.3:

$ echo '{"foo": {"bar": [1, 2, 3]}}' | jello _.foo.bar
[
  1,
  2,
  3
]

jello is like jq, except you can use standard python syntax to filter the JSON. jello removes all of the boilerplate code you would have to add so you can now easily filter JSON within BASH scripts without learning arcane jq syntax.

Here's an example:

$ jc -a | jello -lr '[entry.name for entry in _.parsers if "darwin" in entry.compatible]'
airport
airport_s
arp
...

Try it out with the web demo: https://jello-web-demo.herokuapp.com/

Here's the github: https://github.com/kellyjonbrazil/jello

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/kellyjonbrazil
πŸ“…︎ Jun 09 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.