Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Alan Greenspan
Jun 17, 2001

Entheogen posted:

when i do a left shift, does the left most bit get sent to some carry register? on x86 machines, what would be the name of it?
I guess same would go for the right shift and right most digit.

Assuming the SHL/SAL instructions are used by the compiler (generally a safe bet; but still something I'd put into a unit test), the Carry Flag (CF) contains the last bit that was shifted out of the value.

Adbot
ADBOT LOVES YOU

Alan Greenspan
Jun 17, 2001

xobofni posted:

Really stupid question here about pointers in C.

This code runs just fine.
code:
int main ()
{
    char a[] = "hello world";
    a[0] = 'b';
    return 0;
}
This code crashes.
code:
int main ()
{
    char *a = "hello world";
    a[0] = 'b';
    return 0;
}
I thought those declarations were exaclty the same, but apparently they are not. What am I missing here?

Click me

Alan Greenspan
Jun 17, 2001

Does anybody know of a C++ parser framework that can load BNF grammar files and generate a parser for them on the fly?

The situation is the following: I need to be able to parse assembler code of various platforms which I do not know during development (because it's actually our customers who create the grammar files, not me).

Basically I need to be able to do:

> parser.exe -grammar_file=x86.gra -input=some_asm_file.asm

as well as

> parser.exe -grammar_file=weirdo_cpu.gra -input=some_weirdo_asm_file.asm

The BNF grammars in the gra-files will have predefined constants like MNEMONIC, INTEGER_OPERAND, REGISTER_NAME, and so on and only the order of the tokens in each grammar rule changes.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply