Re: Language design basics



<seexor@xxxxxxxx> wrote in message
news:fb077954-2e31-4c45-946e-715bb6d8f9a7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hihi, just wondering if anyone could supply me with a bit of knowledge
or point me in the right direction...

I'm just after some basic concepts so I can know what/how to research
it more thoroughly. I have some basic programming expertise
(specifically c++, javascript, and perl) - enough to create a *simple*
cryptanalytic bruteforce/analytic script.


1. How do you programme a programming language? ie. in assembly/
binary? --- then, how do you tell the computer that you're giving it
basic instruction?

Interestingly enough, C was written in C. Yeah, the C compiler was written
in C. Basically what they did is they used some language (doesn't matter
which) to create the first simple C compiler, and with that simple C
compiler, they wrote the C compiler.

Basically a compiler will parse the input and write assembly language
executable files. This can be simple or complex, depending on the language
and implementation. Some/most modern compilers output an object file, then
call a linker to produce the final executable file.

That stems from my initial curiosity about mathematical fundamentals,
specifically:

2. How do you programme basic mathematical operators? Is it all a
matter of base conversion - and if so, mainly from two to ten and back
again, or for division possibly all kinds of screwy bases?

Most modern day CPUs have a FPU (Floating Point Unit). With a few assembly
instructions you can do floating point mulitplication, division, etc...
They also have integer instructions add, subtract, multiply, divide. You
just need to make the proper assembly langauges instructions to do so.

While I'm here, although possibly better suited to a different thread:

3. Memory vs. Processing - which is faster/ more efficient? Do I
create *possibly* huge lookup tables or compute my values each time?
Is there a general rule, or should I take levels of wizard and work it
out through memory/ cpu speeds (omg no please have mercy)? Is this
actually a valid dichotomy, or am I barking up the wrong decision
tree?

The FPU has look up tables in it in hardware which are rather fast. Let the
FPU handle it by using the appropriate assembly language instructions.


.



Relevant Pages

  • Re: A Fateman paper
    ... the use of assembly language is a little more common than ... i/o instructions that talk to hardware. ... otherwise are not emitted by the C compiler. ... often emit extra register-register copies that slow things down.) ...
    (comp.lang.c)
  • Re: Is Assembler Language essential in compiler construction?
    ... more interesting and useful than a faked machine language and more ... I taught an undergraduate course on compiler construction where we ... students were able to pick it up quickly. ... together to teach students a specific architecture assembly language, ...
    (comp.compilers)
  • Re: Question about jumps
    ... issues like how flags are set by each of these instructions. ... that led me to develop the pedagogy I used in AoA/32. ... I taught assembly language using MASM (see ...
    (alt.lang.asm)
  • Re: OO compilers and efficiency
    ... > Calculating the address of the virtual function can usually be done ... address (4 instructions). ... personally I think C is a beautiful programming language. ... compiler vendor and a smaller base of skilled programmers. ...
    (comp.programming)
  • Re: Memory Limit for Visual Studio 2005???
    ... It converts code from one language into native code. ... I already carefully explained in what way it is not a compiler, ... The JIT "compiler" does not translate high level language control flow ... role is much closer to that of an assembly language translator. ...
    (microsoft.public.dotnet.languages.csharp)