I have developed a interpreted programming language. It is strongly based on C. The problem is, I want to add a foreach directive and have no clue how to.
I am using Bison and Flex as the parser and lexer generator.
...
I wounder how to implement indentation as block delimiters in bison + flex. Just like in python. I'm writing my own programming language ( mostly for fun, but I intend to use it together with a game engine ), I'll try to come up with something special that minimizes boilerplate and maximizes dev speed.
I have already written an compiler...
From the Bison Manual:
In a simple interactive command parser
where each input is one line, it may
be sufficient to allow yyparse to
return 1 on error and have the caller
ignore the rest of the input line when
that happens (and then call yyparse
again).
This is pretty much what I want, but I am having trouble getting to...
Wikipedia's Interpolation Definition
I am just learning flex / bison and I am writing my own shell with it. I am trying to figure out a good way to do variable interpolation. My initial approach to this was to have flex scan for something like ~ for my home directory, or $myVar , and then set what the yyval.stringto what is returned u...
I'm trying to use flex and bison to create a simple scripting language. Right now, I'm just trying to get a calculator working.
I can't get it to compile, though. When I run this makefile:
OBJECTS = hug.tab.o hug.yy.o
PROGRAM = hug.exe
CPP = g++
LEX = flex
YACC = bison
.PHONY: all clean
all: $(OBJECTS)
$(CPP) $^ -o $(PROGRAM)
clean...
Hello all :)
I've been looking to recognise a language which does not fit the general Flex/Bison paradigm. It has completely different token rules depending on semantic context. For example:
main() {
batchblock
{
echo Hello World!
set batchvar=Something
echo %batchvar%
}
}
Bison apparently supports recognition of these ty...
When compiling my project with gcc and the -Wall option, I get a warning about a statement with no effect in the non-existant last line of my flex file:
Warning:
gcc -Wall -O0 -ggdb3 -DNOSUDO -DJOBC -DDEBUG -c lex.yy.c
tokenizer.l: In function ‘yylex’:
tokenizer.l:179: warning: statement with no effect
Shell Command:
$ wc -l tokeniz...
Okay, in my quest to figure out the necessary stuff to write a compiler, I've reached a bit of a roadblock. It seems that every technology or tool that I find has some opposition somewhere.
I use Bison and Flex right now but I'm getting the feeling that this method is outdated. Is this true? Is this a good forward-compatible way to p...
Dear Overflowns:
I have an executable whose input is contained in an ASCII file with format:
$ GENERAL INPUTS
$ PARAM1 = 123.456
PARAM2=456,789,101112
PARAM3(1)=123,456,789
PARAM4 =
1234,5678,91011E2
PARAM5(1,2)='STRING','STRING2'
$ NEW INSTANCE
NEW(1)=.TRUE.
PAR1=123
[More data here]
$ NEW INSTANCE
NEW(2)=.TRUE.
[etcetera]
In ...
Hello
I want to define char (ie 'a AND 'a') but I am having issues in checking errors.
Here how I write the rule and check:
char " ' " {letter}
code
{char} {
int x =input() ;
//printf("%d",'a');
if(x == 10)
{
return(tCharunterm);
}
...
How to call a flex parser in c ?
...
I am storing the arguments passed to main in yacc in a file. Now I want the lex to read its input from this file rather than the terminal. I know I can point yyin to a file
like yyin = fopen("fn","r"); but this works only when main is in lex. When I use this yyin declaration in main in yacc, it shows an error so please suggest something...
guyz i need to pass an integer array from lex to yacc.i know v can pass an integer using union of yylval but how to pass an array ...pls help me
...
I'm reading Flex & Bison from O'Reilly, and would like to know if learning Regular Expressions beforehand will help in developing a programming language?
...
I have a simple "language" that I'm using Flex(Lexical Analyzer), it's like this:
/* Just like UNIX wc */
%{
int chars = 0;
int words = 0;
int lines = 0;
%}
%%
[a-zA-Z]+ { words++; chars += strlen(yytext); }
\n { chars++; lines++; }
. { chars++; }
%%
int main()
{
yylex();
printf("%8d%8d%8d\n", lines, words, char...
Hello,
I'm building my own language using Flex, but I want to know some things:
Why use lexical analyzers?
There are going to help me in something?
Are they obligatory?
Thanks.
...
Suppose I want my Lex and Yacc program to parse the command line arguments like:
./a.out show memory
I want lex to parse the string "show memory". How do I accomplish this?
...
i want to parse from a string rather than a file. i know that v can use yy_scan_string fn to do it.but for me it's not working properly so pls help me
...
what libraries should be linked in lex & yacc (solaris) to include YY_BUFFER_STATE. when i use
YY_BUFFER_STATE in lex and compile it .i get an error saying tat it is undeclared.but when i do it in unix i am getting the output so pls help me.
...
I wanted to experiment with the Shakespeare programming language, so I downloaded it from here and executed the Makefile using cd spl-1.2.1 Make.
The compilation of spl2c executes with a couple warnings:
scanner.l:600: warning, rule cannot be matched
<stdout>:5808: warning: ‘yyunput’ defined but not used
And then when it at...