question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

introduce a ParExpression AST node type

See original GitHub issue

I can no longer compile the language module, since new code like:

[""->""].map((k->v) => v else "<null>");

desugars to the invalid:

[""->""].map((entry) => let (k->v = entry) v else "null");

Ceylon AST complains:

Exception in thread "main" ceylon.language.AssertionError "Assertion failed: Check precedence
    violated is DisjoiningExpression|IfElseExpression|LetExpression expression = expressionToCeylon(letClause.expression, update)"
    at ceylon.ast.redhat.letExpressionToCeylon_.letExpressionToCeylon(LetExpression.ceylon:25)
    at ceylon.ast.redhat.expressionToCeylon_.expressionToCeylon(Expression.ceylon:31)

The Redhat AST is:

|  |  |  |  |  |  |  |  |  |  +  [Expression] (2:27-2:41) : String
|  |  |  |  |  |  |  |  |  |  |  +  [LetExpression] (2:27-2:41) : String
|  |  |  |  |  |  |  |  |  |  |  |  +  [LetClause] (2:27-2:41)
|  |  |  |  |  |  |  |  |  |  |  |  |  +  [Destructure] (2:18-2:21)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [ValueModifier] : unknown
|  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [KeyValuePattern] (2:18-2:21)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [VariablePattern] (2:18-2:18)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [Variable] (2:18-2:18) : value k => String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  + k [Identifier] (2:18-2:18)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [ValueModifier] : String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [VariablePattern] (2:21-2:21)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [Variable] (2:21-2:21) : value v => String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  + v [Identifier] (2:21-2:21)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [ValueModifier] : String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [SpecifierExpression]
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [Expression] : String->String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [BaseMemberExpression] : String->String : _0 : value run.anonymous#0._0 => String->String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  + _0 [Identifier]
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [InferredTypeArguments]
|  |  |  |  |  |  |  |  |  |  |  |  |  +  [Expression] (2:27-2:41) : String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  + else [DefaultOp] (2:27-2:41) : String
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [BaseMemberExpression] (2:27-2:27) : String : v : value v => String [!][expression type is not optional: 'String' cannot be null]
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  + v [Identifier] (2:27-2:27)
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  +  [InferredTypeArguments]
|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  + <null> [StringLiteral] (2:34-2:41) : String

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
gavinkingcommented, Aug 15, 2016

It sounds like we’re resorting to nastiness here to paper over the lack of a Tree.ParenthesizedExpression AST node type. Why not just add one?

0reactions
jvasileffcommented, Aug 28, 2016

@gavinking Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ast — Abstract Syntax Trees
Source code: Lib/ast.py The ast module helps Python applications to process trees of the ... This type must be used when building a...
Read more >
Introduction to Abstract Syntax Trees
Traversing an AST means visiting the different nodes of the tree to gain insights or perform actions. One of the most common use...
Read more >
ASTNode (JavaScript Development Tools API Specification)
An AST node represents a JavaScript source code construct, such as a name, type, expression, statement, or declaration. Each AST node belongs to...
Read more >
Programming Project #4: Abstract Syntax Trees
The file Ast.java documents the Abstract Syntax Tree data structure. There are many different kinds of AST node. For example, there is one ......
Read more >
CS 160 - Project 4
This project has two main steps: first understand the AST classes that you will use to build the AST, then write Bison actions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found