Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

lex/yacc and verilog
Hi all,

I'm new to this forum and need some help with lex/yacc.  

I'm writing a parser that takes a verilog module specification I've develope
d as an input.

My question might seem relatively simple to this group since my job function
 is not software development.  My main problem is that I can't figure out wh
ere to place a sensible boundary between lex and yacc.

The verilog signal specification we've developed can take the form of:

[code]
variable = 0 to 10;
SIGNAL storage_{variable}_ack[12:0]
SIGNAL storage_req
SIGNAL storage_buffer[12:0]
[\code]

How do I write a lexer that takes into account all of these formats, and mor
e importantly, how do I then store the bit range values and the variable ref
erences and associate them with the signal?

For now I've written complex grammar rules in yacc to account for each uniqu
e combination:

[code] 
STRING '[' INT ':' INT ']'
STRING '{' STRING '}' STRING '[' INT ':' INT ']'
[\code]
etc etc etc...

It's easy to observe that the grammar rules quickly become unmanageable at s
ome point and that the tool will not scale easily as multiple variables can 
be referenced...

It seems obvious to me that this bit-range/variable parsing needs to be done
 initially in the lexer, and then the entire signal structure passed to yacc
..  I'm just not sure how to do this in lex.  This would be a cakewalk in s
omething like PERL, but lex cannot grab "pieces" of a regular expression mat
ch... or at least I'm not aware of it.

Can someone help?

Signed,
hardware architect in dire need of good software experience

Report this thread to moderator Post Follow-up to this message
Old Post
80085
05-13-05 11:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compilers archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:58 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.