Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 13th, 2005, 4:17 PM   #1
80085
Newbie
 
Join Date: May 2005
Posts: 1
Rep Power: 0 80085 is on a distinguished road
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 developed 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 where to place a sensible boundary between lex and yacc.

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

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

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

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

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

It's easy to observe that the grammar rules quickly become unmanageable at some 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 something like PERL, but lex cannot grab "pieces" of a regular expression match... or at least I'm not aware of it.

Can someone help?

Signed,
hardware architect in dire need of good software experience

Last edited by big_k105; May 13th, 2005 at 4:45 PM. Reason: fixed code tags :)
80085 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:51 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC