Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
73 views

Parse an expression with non whitespace seperated operators

I am currently working on a compiler. Recently, I stumbled upon an issue concerning the parsing of operators in an expression. Obviously I have not found this to be an issue in other languages, which ...
YayL's user avatar
  • 11
1 vote
1 answer
366 views

Creating a static unordered_set from keys of a static unordered_map

I'm writing a front-end for a compiler and currently working on implementing punctuator scanning functionality. I've got a Punctuator class that I'd like to use to represent punctuators from the input ...
vmishel's user avatar
  • 145
1 vote
0 answers
27 views

Issue with identifying invalid lexemes in C initialization statement

I have been working on a code snippet to identify invalid lexemes in a C initialization statement. The code is intended to check for invalid data types, invalid identifiers, and invalid constant ...
BRENDAN's user avatar
  • 11
0 votes
1 answer
32 views

Typing /0 (not \0) into a lex program causes unexpected behavior

I made a simple lex program for school, and for some reason it has an unexpected behavior while reading "/0". The program is as following: %% [a-z] printf("char %c", yytext[0]-32); ...
אסף נבון's user avatar
0 votes
1 answer
29 views

lex file not executing

I was tring to doing my assignment. That is "Write a program using YACC specifications to implement syntax analysis phase of compiler to validate type and syntax of variable declaration in C ...
Pooja Jadhav's user avatar
1 vote
1 answer
396 views

Binary and unary minus operator in Lexical Analyzer

So, I am doing a lexical analysis of a TOY programming language using flex. I am currently stuck at the following point. Minus sign: As we know the minus sign can have two meanings by defining them as ...
Deepak Sangle's user avatar
-1 votes
1 answer
106 views

Avoiding overlap with similar regex patterns during tokenization

Background I've made a couple simple compilers before, but I've never properly addressed this issue: Say I have a token LT which searches the expression < and a token LTEQ which searches <=. A ...
Jam's user avatar
  • 584
0 votes
0 answers
399 views

Lex program output is not coming

%{ int count=0; %} %% [/][/][a-zA-Z0-9]* {count++;} %% int yywrap() { return 1; } int main() { yylex(); printf("lines: %d",count); return 0; } I am executing this ...
Bhumika Ailawadi's user avatar
0 votes
0 answers
94 views

Unexpected character JFLEX

Hello i was watching a tutorial on youtube. It was the start of tutorial but when i tried to wrote the code and run this flex.l file. The output show unexpected character [a-z] {printf("Single ...
coder123's user avatar
2 votes
1 answer
176 views

Lex file doesn't recognize keywords. How can I write my regex to read particular keywords?

This is my lex file %{ #include<stdio.h> int codelines = 0; int commentlines = 0; int blanklines = 0; int headerlines = 0; int brackets = 0; int keywords = 0; %...
smallguyxoxo's user avatar
0 votes
2 answers
1k views

How can i ignore comments in a string based on compiler design?

I want to ignore every comment like { comments } and // comments. I have a pointer named peek that checks my string character by character. I know how to ignore newlines, tabs, and spaces but I don'...
sep_The_new_elixiR's user avatar
0 votes
0 answers
74 views

How to determine the goal symbol when tokenize ECMAScript in lexical grammar

I'm writing a JS macro preprocessor, and refer to the ECMA-262 specification for some guide to parse js code. I use the code parser to determine where to do macro replace in a standard/precise way, ...
Lane Sun's user avatar
1 vote
1 answer
1k views

Parser gives a unknown type name error for entry_t

I'm editing my first parser and I'm very new to compiler design. I'm using a hashtable to store tokens. I have created a struct called struct_t in my symboletable.h file. When I try to create a new ...
Shehan Fernando's user avatar
0 votes
1 answer
615 views

Lexical analyzer gives undefined error for yylineno

Im pretty new to compiler design. im trying to take the first step in lexical analyzer trying to run the following code. %{ #include <stdlib.h> #include <stdio.h> #include "...
Shehan Tearz's user avatar
2 votes
1 answer
441 views

Skipping nested comments recursively in a scanner

I'm writing a scanner for a compiler and have a function to skip comments whenever it sees them, I wanted to know how one would skip nested comments, i.e something like " hello "w" ...
ismaael17's user avatar
  • 146

15 30 50 per page
1
2 3 4 5
10