Skip to main content
4 votes
1 answer
178 views

I'm writing a parser, using yacc, similar to yacc itself, in that my input language will contain interspersed scraps of C code. Consider the canonical sort of yacc production: something: some thing { $...
Steve Summit's user avatar
  • 49.5k
2 votes
1 answer
157 views

I'm using this answer as my template to add the prefix "eval": https://stackoverflow.com/a/48879103/14956120 The only difference from that answer, is that I'm on windows (using msys2), and ...
Carl HR's user avatar
  • 1,099
4 votes
2 answers
79 views

I recently revisited an old assignment that I did not get to work and I am still curious as to why it isn't. This assignment was to create a lex regular expression in C that would validate both ...
Julio Garcia's user avatar
0 votes
1 answer
73 views

Test Ouputs: ./parse -r /[123456]/ Accepted! ./parse -r /[1234567]/ zsh: segmentation fault (core dumped) ./parse -r This is my flex rule for the token. \[^?([^\\\]]|\\.)*\] {yylval.value = strdup(...
Karidus's user avatar
  • 31
0 votes
1 answer
91 views

I want to make a compilator for a language similar to C. Declarations go first, then functions. Declarations can only be "int" while functions can return "int" or "void". ...
mr Klaus's user avatar
0 votes
1 answer
90 views

I have a lex file, and based on the original, I would like to add support for recognizing (.:). My modifications are as follows: %option caseless ALP [a-z]+ NUM [0-9]+ REF {ALP}{NUM} ...
lijiang99's user avatar
1 vote
0 answers
56 views

An example circuit assignment looks like this: A= B or C xor K. When an identifier is undeclared its error message should be printed with the seen order left to right. To do so I attached an ...
Metin's user avatar
  • 21
0 votes
1 answer
62 views

The below is my two files: calc.l %{ #include "y.tab.h" %} %% [0-9]+ { yylval = atoi(yytext); return NUMBER; } [ \t\n ] ; "+" { return '+'; } "*" { return '*'; } &...
user27828776's user avatar
0 votes
1 answer
106 views

I'm working on integrating Swift with a simple parser generated using lex and bison in an Xcode 16.1 project. Below is my current code: calc.l %{ #include "calc.tab.h" #include <stdlib.h&...
Fab's user avatar
  • 1,606
0 votes
0 answers
64 views

I’m working on a DFA-based lexer using regex derivatives for tokenizing lexemes. I've built a setup that, theoretically, should handle regex simplification and DFA transitions accurately. For the most ...
Jacques's user avatar
  • 51
0 votes
1 answer
93 views

I am writing a parser using a context-free grammar with Bison and Flex to handle a simple language that includes for loops. However, I'm encountering a syntax error when I try to parse valid for loop ...
ss511's user avatar
  • 63
1 vote
1 answer
64 views

I try to write regular definitions to display the line of string for the following using LEX. a.Match any string starting with d, and ending with t b. Matches the string def c.Match one or more ...
user27828776's user avatar
0 votes
1 answer
67 views

I am trying to build a parser that will only parse C++ macro calls in a code-base and store the arguments in the macro calls for further processing. In that code-base, it is known that macros contain ...
Ricky's user avatar
  • 735
0 votes
0 answers
59 views

I am trying to treat extended ascii characters with lex, e.g., àÀ. %{ #include <stdio.h> %} DIGIT [0-9] ALPHA_CHAR [A-Za-z] EXTENDED [àÀ] CHAR {ALPHA_CHAR}|{...
tony_merguez's user avatar
0 votes
0 answers
102 views

the first thought I had was that I didn't manage to handle the new line character properly because it keeps throwing the new line character "\n" whenever I try to append the instructions for ...
ali eltaib's user avatar

15 30 50 per page
1
2 3 4 5
123