Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
454 views

How to build the antlr grammar provided?

I would like to build a cpp parser using cpp and I'm using ANTLR4. I notice there is this 'grammar' section from the official github antlr grammar github and I've downloaded it. While opening the CPP ...
EggDi's user avatar
  • 13
-1 votes
1 answer
86 views

How can I fix my ambiguity in bison file? [closed]

I m working on a simple interpreter and I m using bison and flex for my lexer and parser.I have a problem when it comes to the parser : progr :decl_classes decl_gvars decl_functions block {...
Stefan Cristea Olaru WolfGamer's user avatar
2 votes
1 answer
53 views

Template Circulation Definition

I am creating an intrusive pointer as follows: class RefCounted {}; template <typename T> concept RefCountedDerived = std::is_base_of_v<RefCounted, T>; template <RefCountedDerived T&...
X1ngChui's user avatar
-3 votes
1 answer
592 views

What is the precedence and associativity of operators?

What is the precedence and associativity of operators in C++? Who defines operator precedence and associativity, and how does it relate to order of evaluation? explains how those properties emerge ...
Jan Schultke's user avatar
  • 41.1k
0 votes
1 answer
191 views

Why are curly braces {} NOT considered an operator in C++? [closed]

I've checked official operator list, but didn't see {} appear in any list of operator (either redefinable or non-redefinable). As far as I know, {} is used to specify a block of code, and also used to ...
Crackie's user avatar
  • 355
-1 votes
3 answers
793 views

Why is int*& used to declare a reference to a pointer instead of int&*

I thought & and * were just syntactical conventions to declare pointers and references, but when trying to declare a reference to an int*, I have to use int*& otherwise I get this error: ...
Kryptic Coconut's user avatar
0 votes
2 answers
137 views

mismatched input in ANTLR4

I'm new to ANTLR. I don't see any problem with my grammar, but when I run the parse tree, ANTLR gives me mismatched input message. Could anyone help me explain why I get that? Here is my lexer lexer ...
Vicky Nguyen's user avatar
2 votes
1 answer
118 views

Is (multi-word type name){expression-list} legal?

Consider: (long long){1}; It’s not a C-style cast expression per [expr.cast]/1: The result of the expression (T) cast-expression is of type T. The result is an lvalue if T is an lvalue reference ...
Blackteahamburger's user avatar
0 votes
2 answers
83 views

How to analyze complicated type expressions in C++?

Things seem to become complicated when dealing with compound C++ types. For example, how to analyze the type of token fp in the codes below? int *f(int *p, int a) { return p + a; } int *(*fp())(...
Raine Huang's user avatar
2 votes
1 answer
277 views

Trying to parse nested expressions with boost spirit x3

My ultimate goal is to write a hlsl shading language parser. My first experience with parsing has been by following bob nystrom's "crafting interpreters". The issue I am currently facing is ...
Daniel Dokipen Elliott's user avatar
0 votes
1 answer
390 views

ANTLR4 parse tree doesn't contain rule names

ANTLR4 doesn't show rule names in parse tree. For example, 1 + 2 is printed as: Code in main: std::string test = "1 + 2"; ANTLRInputStream input(test); GrammarLexer lexer(&...
gavrilikhin.d's user avatar
0 votes
2 answers
205 views

for loop IR generation in Bison

Consider the following grammar rule: forstmt: for openparentheses nexpr semicolon expr semicolon nexpr closeparentheses stmt {} nexpr: expr { } | %empty { } expr: . . . // ...
Parsa Noori's user avatar
0 votes
1 answer
424 views

how to read c++ iso standard? i mean the way

I'm reading n4860 now and i have some curiosity about this. i don't know how to explain it so i will just show an example. now i'm looking "unordered_set" and the draft said template<...
신승빈's user avatar
  • 387
2 votes
1 answer
107 views

How is C++ syntactic evolution managed?

Separate from frontend implementers' experiences, are there formal standards that syntactic extensions to the C++ grammar are required to meet? That is, are proposed extensions subjected to any form ...
John Yates's user avatar
  • 1,057
1 vote
0 answers
42 views

language grammar problem for allocate memory in our project

I find a 'new' code in our project, like: class A { public: A(int x); }; void func() { A* pA = nullptr; new (pA) A(123); // what is this line meaning? } the 'new' function just like void* ...
dangerman's user avatar

15 30 50 per page
1
2 3 4 5
10