[Lldb-commits] [lldb] [LLDB] Add AST node classes, functions, etc. for Data Inspection Lang… (PR #95738)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 9 03:20:12 PDT 2024


================
@@ -0,0 +1,43 @@
+(* LLDB Debug Expressions, a subset of C++ *)
+(* Insired by https://www.nongnu.org/hcb *)
+
+expression = cast_expression;
+
+cast_expression = unary_expression;
+
+unary_expression = postfix_expression
+                 | unary_operator cast_expression;
+
+unary_operator = "*" | "&" | "-" ;
+
+postfix_expression = primary_expression
+                   | postfix_expression "[" expression "]"
+                   | postfix_expression "." id_expression
+                   | postfix_expression "->" id_expression
+
+primary_expression = numeric_literal
+                   | boolean_literal
+                   | pointer_literal
+                   | id_expression
+                   | "this" ;
----------------
labath wrote:

Other languages may use a different keyword (`self` typically) to refer to "this" object (in which case `this` can refer to a regular variable). Special-casing `this` in the parser could make that difficult, so it may be better to treat `this` as a regular identifier, and only resolve it later, once we know which language we're in.

https://github.com/llvm/llvm-project/pull/95738


More information about the lldb-commits mailing list