Click here to Skip to main content
15,889,651 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Need to display dialog until all questions answered Pin
Sascha Lefèvre11-Oct-17 4:01
professionalSascha Lefèvre11-Oct-17 4:01 
AnswerRe: Need to display dialog until all questions answered Pin
Jochen Arndt11-Oct-17 4:07
professionalJochen Arndt11-Oct-17 4:07 
QuestionSorting Algorithm to maximize 'availability' (help please) Pin
Member 134476015-Oct-17 3:30
Member 134476015-Oct-17 3:30 
AnswerRe: Sorting Algorithm to maximize 'availability' (help please) Pin
Ralf Meier6-Oct-17 0:35
mveRalf Meier6-Oct-17 0:35 
AnswerRe: Sorting Algorithm to maximize 'availability' (help please) Pin
Gerry Schmitz7-Oct-17 6:41
mveGerry Schmitz7-Oct-17 6:41 
QuestionEfficiently comparing results from an XPath query to a resultset returned from a database table Pin
terrybogard44-Oct-17 14:49
terrybogard44-Oct-17 14:49 
AnswerRe: Efficiently comparing results from an XPath query to a resultset returned from a database table Pin
Gerry Schmitz7-Oct-17 6:57
mveGerry Schmitz7-Oct-17 6:57 
QuestionConditional assembly Pin
A Jordison27-Sep-17 23:53
A Jordison27-Sep-17 23:53 
I've written a 6502 assembler (for Commodore machines) and one of its features is conditional assembly, like this;

ifdef var1
  <some code>
else
  <some other code>
elseif

So if var1 is defined then <some code=""> is assembled, else <some other="" code="">. However I want to expand this by allowing nested conditional assembly, like this:

ifdef var1
  ifdef var2
    <some code>
  else
    <some other code>
  endif
else
  <yet more code>
endif

Basically the way my assembler works at the moment is if the 'ifdef' condition fails (the variable is not defined) then all of the code following it (until the corresponding 'else' directive) is ignored. It's the 'corresponding else' part which is the problem here. How do I determine which 'else' corresponds with which 'ifdef'? Please note that I can't use the code indentation to determine which 'level' the directives are on. In real life, all of the code will be in the first column (no indentation at all) as my assembler needs directives to be in the first column.

I don't need specific code as such, I'm more interested in an algorithm for this.

In case you're interested, here's my assembler:
www.ajordison.co.uk

modified 28-Sep-17 6:16am.

AnswerRe: Conditional assembly Pin
Jochen Arndt28-Sep-17 0:09
professionalJochen Arndt28-Sep-17 0:09 
GeneralRe: Conditional assembly Pin
A Jordison28-Sep-17 0:13
A Jordison28-Sep-17 0:13 
GeneralRe: Conditional assembly Pin
Jochen Arndt28-Sep-17 0:20
professionalJochen Arndt28-Sep-17 0:20 
AnswerRe: Conditional assembly Pin
Gerry Schmitz28-Sep-17 10:33
mveGerry Schmitz28-Sep-17 10:33 
QuestionCompare similarity of values that can have different lenght, number of words between 2 or more documents. Pin
Member 1342117220-Sep-17 21:46
Member 1342117220-Sep-17 21:46 
AnswerRe: Compare similarity of values that can have different lenght, number of words between 2 or more documents. Pin
Gerry Schmitz21-Sep-17 12:49
mveGerry Schmitz21-Sep-17 12:49 
QuestionEfficiently sort the following? Pin
arnold_w24-Aug-17 10:18
arnold_w24-Aug-17 10:18 
GeneralRe: Efficiently sort the following? Pin
harold aptroot24-Aug-17 10:28
harold aptroot24-Aug-17 10:28 
GeneralRe: Efficiently sort the following? Pin
arnold_w24-Aug-17 10:48
arnold_w24-Aug-17 10:48 
AnswerRe: Efficiently sort the following? Pin
Richard MacCutchan24-Aug-17 21:05
mveRichard MacCutchan24-Aug-17 21:05 
AnswerRe: Efficiently sort the following? Pin
Richard Deeming25-Aug-17 1:47
mveRichard Deeming25-Aug-17 1:47 
GeneralRe: Efficiently sort the following? Pin
arnold_w28-Aug-17 0:40
arnold_w28-Aug-17 0:40 
GeneralRe: Efficiently sort the following? Pin
Richard Deeming29-Aug-17 1:53
mveRichard Deeming29-Aug-17 1:53 
GeneralRe: Efficiently sort the following? Pin
arnold_w30-Aug-17 4:04
arnold_w30-Aug-17 4:04 
GeneralRe: Efficiently sort the following? Pin
Richard Deeming30-Aug-17 4:40
mveRichard Deeming30-Aug-17 4:40 
AnswerRe: Efficiently sort the following? Pin
Alan N30-Aug-17 5:48
Alan N30-Aug-17 5:48 
GeneralRe: Efficiently sort the following? Pin
arnold_w31-Aug-17 23:50
arnold_w31-Aug-17 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.