In Computer Science when do you learn the fundamentals of high level languages and the methodologies a compiler uses to create assembly instructions? What is the primary book used for this course? Like, if you’re using Ada or Ghidra and trying to piece together what is happening in binary execution, I want to know structures to look for on this basic level.

I’m asking about the simple stuff like what you find in Arduino sketches with variables, type declarations, branching, looping, booleans, flags, interrupts etc. Also how these might differ across architectures like CISC/RISC, Harvard/von Neumann, and various platform specifics like unique instruction set architecture implementations.

I have several microcontrollers with Flash Forth running the threaded interpreter. I never learned to branch and loop in FF like I can in Bash, Arduino, or Python. I hope exploring the post topic will help me fill in the gap in my understanding using the good ol’ hacker’s chainsaw. If any of you can read between the lines of this inquiry and make inference that might be helpful please show me the shortcuts. I am a deeply intuitive learner that needs to build from a foundation of application above memorization or theory. TIA

  • @marcos@lemmy.world
    link
    fedilink
    69 months ago

    I don’t understand…

    Are you trying to learn how to make compilers/interpreters? Are you trying to learn how to write assembly like the compiler does? Or are you trying to have a deeper understanding of those languages?

    Those are all very different things. (Computer architecture is also one very different thing, but from what I understand that’s not what you want.)

    • BoscoBear
      link
      49 months ago

      Not op. Deeper understanding of how these compilers are written across different architectures yet share common compiled structures.

      • @marcos@lemmy.world
        link
        fedilink
        29 months ago

        “Deeper understanding of how these compilers are written” you can get in a compiler book. I’ve found a copy of the dragon book here: https://iitd-plos.github.io/col729/refs/ALSUdragonbook.pdf

        Currently, I’d recommend you read a monadic parser tutorial and jump over the practical material about compiler parsing (the theory is still very useful). There re more modern books, more focused on semantics, but I don’t remember of any to recommend you.

        “Deeper understanding about compilers across different architectures” looks like an assembly course to me. If you want to compare RISC and CISC, you’ll probably want x86 assembly and something like MIPS. (Notice that you will probably never use any of those on practice. But any assembly you would use on practice is too complicated to start with.)

        But that “yet share common compiled structures” part, I have no idea at all. I’m not sure anybody formally studies this. You may want to read about the LLVM intermediate representation and how to create a backend for it.

        • BoscoBear
          link
          29 months ago

          The LLVM is probably the most appropriate answer to my question. Books about the development of it would be outstanding.

    • @j4k3@lemmy.worldOP
      link
      fedilink
      English
      19 months ago

      I want to get a deeper understanding of assembly to high level structures. FF has poor documentation in general, but I can compile my own Forth words using assembly. I don’t know assembly as a functional language but know the basics. I’m mostly looking for a way to better understand what FF is doing or write my own branching. I also want a better understand reverse engineering basics using ghidra.

      • @marcos@lemmy.world
        link
        fedilink
        39 months ago

        Oh, ok. You want to learn PIC assembly.

        Forth is a fun language, in that most of what one would study on compilers do no apply to it at all. You would need some book specifically aimed at Forth.

        I don’t think you will get anything useful from computer science material. You need focused, technical material, not theory.

        Anyway, a processor manual is usually called a “datasheet”. (E.g. https://ww1.microchip.com/downloads/en/devicedoc/35007b.pdf) That will have the hardware information (instructions, interruptions, I/O, embedded devices, hardware flags, register types, etc).

        The types, variables, and control flow are defined by the language, not the hardware. And again, whatever Forth gives you will be highly unusual and probably not covered on a compilers book. I don’t have a good book on Forth to recommend.

        (I hope somebody gets a better recommendation than mine, because honestly, now that I understood your problem, this is quite useless. Sorry.)