10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Alright, so I'm writing a file for the lexical analyzer (lex). It will be used to check C code (collecting the identifiers and storing those names along with the line numbers the identifier was found on). I'm not used to 'C' so I'm having some difficulty.
I am using a function (insertId()) to... (4 Replies)
Discussion started by: D2K
4 Replies
2. UNIX for Dummies Questions & Answers
Hi everyone!
This is my very first post, sorry if I'm not posting in the right category.
I'm trying to match a newline "/n" using lex/yacc.
For example,
print(9,'\n',8)
should print
9
8
now do I write a regular expression to match exactly " '\n' "
Thanks! (1 Reply)
Discussion started by: code21
1 Replies
3. Programming
When i write the source code in netbeans environment,if the source code,there are chinese characters,chinese characters will be displayed as box,how to solve this problem?please (2 Replies)
Discussion started by: fang_xiaoan
2 Replies
4. Programming
Hi ,
We have developed a grammer for our domain language using lex n yacc.
I want to know is there any pre defined lex-yacc function which gets call before executing any rule (or rules).
Oue requirement is, before processing any rule ,we want to perform some specific actions ?
is there... (0 Replies)
Discussion started by: supritjain
0 Replies
5. Programming
Hi ,
I need to develop a parser which should match something like
1. text a=5 " a=20";
2. text a=..."
a=20";
3 text a=..."
a=20
b=34
c=12
";
I have used this regular expression in my Lex file to generate the tokens:
\".\s*.*\s.\" (8 Replies)
Discussion started by: vishwa787
8 Replies
6. Solaris
Hi everyone,
I would like to know how to compile and run lex programs on solaris 10.
the conventional way is
$ lex <name.l>
$ cc lex.yy.c -ll
$ ./a.out
but while trying to execute the 2nd command :i get a reference saying that the command is old or that main is not supported...
Hence... (1 Reply)
Discussion started by: wrapster
1 Replies
7. Programming
Hi all
I am using lex for my application scanning and I need to skip some lines for which I don't know the exact pattern.
So, could anybody tell me the regular expression to display lines NOT beginning with the specified pattern.
I know how to display lines beginning with the... (1 Reply)
Discussion started by: axes
1 Replies
8. Programming
Hi all,
I'm working with flex (version 2.5.4a) on GNU/linux. I used it to develop 4 scanner C files for matching different patterns within an input file. But the problem now on my hand is that I need to conditionally combine these. That is in main (placed in a separate C file other than the 4... (5 Replies)
Discussion started by: Rakesh Ranjan
5 Replies
9. Shell Programming and Scripting
taskes one or more .l files and compiles them
#!/usr/bin/csh
#while loop to carry on asking user to enter the files
while $number!=0
echo "enter file name"
#check to see if file ends with .l
#if file ends with .l compile lexx.yy.c file for each file
this is how i think it needs... (1 Reply)
Discussion started by: homerj546
1 Replies
10. Shell Programming and Scripting
this is my lex file ------------ test.l
%%
printf("%c",yytext+'a'-'A');.ECHO;
how do i compile it
$ lex test.l cc lex.yy.c -o test -ll <------|
|
if this is correct do i add this line--------| @the command line or does it... (0 Replies)
Discussion started by: sinner
0 Replies
lex(1) General Commands Manual lex(1)
Name
lex - generate lexical analyzer
Syntax
lex [-tvfn] file...
Description
The command generates programs to be used in simple lexical analysis of text. The input files (standard input default) contain regular
expressions to be searched for, and actions written in C to be executed when expressions are found.
A C source program, 'lex.yy.c', is generated. It is compiled using the following command line:
cc lex.yy.c -ll
This program copies unrecognized portions of the input to the output, and executes the associated C action for each regular expression that
is recognized.
Options
-f Runs a faster compilation (does not pack resulting tables). This is limited to small programs.
-n Prints no summary information (default option).
-t Writes to standard output instead of to file
-v Prints one-line summary of generated statistics.
Examples
In the following example, the command
lex lexcommands
draws instructions from the file lexcommands, and places the output in lex.yy.c. The command
%%
[A-Z] putchar(yytext[0]+'a'-'A');
[ ]+$
[ ]+ putchar(' ');
is an example of a program that would be put into a command file. This program converts upper case to lower, removes blanks at the end of
lines, and replaces multiple blanks by single blanks.
See Also
sed(1), yacc(1)
"LEX - Lexical Analyzer Generator", Supplementary Documents, Volume 2: Programmer
lex(1)