LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-09-2007, 09:57 PM   #1
biffle
LQ Newbie
 
Registered: Dec 2003
Location: Wenatchee, WA
Distribution: redhat
Posts: 8

Rep: Reputation: 0
jump to label under gcc


gcc extends c to permit a computed goto. Supposedly you can jump to the address codeaddress a labelled code section

codelabel: (some code)

by declaring

void * codeaddress

and assigning

codeaddress = &&codelabel

This is used to write threaded-code interpreters or compilers, e.g. for SMALLTALK, but I cannot make the code in the references under "threaded code" on the Web work.

Does anyone have experience with this?

Thanks
 
Old 06-10-2007, 02:26 PM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 222

Rep: Reputation: 35
Hi, sorry i don't get quite what you're going to do. Do you want to jump to different places, depending on some state? I think what will work is somthing like:

Code:
int i=0;
label:
++i
if (i<3) goto label;
I you do want to write a parser / interpreter for some kind of programming language you may have look at the yacc / bison tools.
 
Old 07-02-2007, 11:19 PM   #3
biffle
LQ Newbie
 
Registered: Dec 2003
Location: Wenatchee, WA
Distribution: redhat
Posts: 8

Original Poster
Rep: Reputation: 0
- thanks. Will look at Bison, but what I want to do is to write a compiler that creat

Quote:
Originally Posted by traene
Hi, sorry i don't get quite what you're going to do. Do you want to jump to different places, depending on some state? I think what will work is somthing like:

Code:
int i=0;
label:
++i
if (i<3) goto label;
I you do want to write a parser / interpreter for some kind of programming language you may have look at the yacc / bison tools.
- THANKS, WILL LOOK AT bISON. What I want to do is to create a compiler that generates a pointer array COMPILE[n] containing successive lavel addresses &&labeladdress. I succeeded in dong that, but the addresses are wrong. Maybe this works only for simple interpreters.

thanks again, Biffle
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jump drive OS? duped Linux - Laptop and Netbook 1 05-01-2007 05:56 PM
Making the Jump ! schitzo1978 Linux - Newbie 10 12-13-2005 01:12 PM
Jump Drive dudeman41465 Linux - Hardware 3 06-28-2005 12:31 AM
jump drive kingcobrawoods Linux - General 2 01-04-2005 02:23 PM
forum jump aizkorri LQ Suggestions & Feedback 4 06-10-2004 01:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration