Is there a way to get a compiler for the original B programming language?What was the first programming bookP′′ Language Interpreter/Compiler ResourcesDoes a CDC 1604 emulator exist with a functional FORTRAN compiler?Do any mainframe emulators exist with a functional FORTRAN compiler?Who is credited for the creation of Assembly Language?Are there any old and nowadays active Operating Systems which has only BASIC Programming Language?Which was the first programming language that had data types?What was the first language compiler to support subtype polymorphism?What was the first language to offer “full” structured programming support?How to add an “int” to a “float” in the B programming language?

Old story about a creature laying pyramid shaped eggs on Mars

Copper as an adjective to refer to something made of copper

Dimmer switch not connected to ground

Can an earth elemental drag a tiny creature underground with Earth Glide?

Where to draw the line between quantum mechanics theory and its interpretation(s)?

What is the thing used to help pouring liquids called?

What does the copyright in a dissertation protect exactly?

What word describes the sound of an instrument based on the shape of the waveform of its sound?

Does Thanos's ship land in the middle of the battlefield in "Avengers: Endgame"?

How did the Force make Luke hard to hit in the Battle of Yavin?

Convert Numbers To Emoji Math

What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?

Hostile Divisor Numbers

Is there any other simpler way to draw the following cross section?

What is more safe for browsing the web: PC or smartphone?

How to speed up large double sums in a table?

Why doesn't a particle exert force on itself?

hl with custom color and linebreak and math

Can you figure out this language?

TIP120 Transistor + Solenoid Failing Randomly

HSA - Continue to Invest?

Gerrymandering Puzzle - Rig the Election

Collision domain question

Changing stroke width vertically but not horizontally in Inkscape



Is there a way to get a compiler for the original B programming language?


What was the first programming bookP′′ Language Interpreter/Compiler ResourcesDoes a CDC 1604 emulator exist with a functional FORTRAN compiler?Do any mainframe emulators exist with a functional FORTRAN compiler?Who is credited for the creation of Assembly Language?Are there any old and nowadays active Operating Systems which has only BASIC Programming Language?Which was the first programming language that had data types?What was the first language compiler to support subtype polymorphism?What was the first language to offer “full” structured programming support?How to add an “int” to a “float” in the B programming language?













17















I am learning about the original B programming language, but I don't have a compiler.



Is there an emulator for an old computer that can run an old operating system that have a compiler for the original B programming language?










share|improve this question


























    17















    I am learning about the original B programming language, but I don't have a compiler.



    Is there an emulator for an old computer that can run an old operating system that have a compiler for the original B programming language?










    share|improve this question
























      17












      17








      17








      I am learning about the original B programming language, but I don't have a compiler.



      Is there an emulator for an old computer that can run an old operating system that have a compiler for the original B programming language?










      share|improve this question














      I am learning about the original B programming language, but I don't have a compiler.



      Is there an emulator for an old computer that can run an old operating system that have a compiler for the original B programming language?







      history programming






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 27 at 13:46









      user13493user13493

      863




      863




















          3 Answers
          3






          active

          oldest

          votes


















          11














          I found an LLVM-based implementation of Ken Thompson's PDP-11 flavour of B on GitHub: https://github.com/dobyrch/dbc and also an x86-based implementation of the Honeywell flavour: https://github.com/aap/abc. abc appears to have been reconstructed from documentation, and due to its x86 nature is a little hackish:




          Since B was first implemented for machines with word addressing, some hacking was required to make it work on the byte addressed x86. Addresses filled in by the linker are always byte addresses, so pointers to these addresses are collectively stored at the end of the .data section and are then converted to word addresses at runtime, before main() is called.



          The generated assembly is very inefficient, not even constant expressions are reduced at compile time. Also I/O is currently not buffered.




          However, dbc comes with its own issues:




          • All operators and statements are implemented, although they haven't all been thoroughly tested. I suspect some edge cases with oddly placed labels may generate invalid LLVM IR.

          • Every library function has been implemented, although gtty() and stty() differ slightly from their descriptions in the manual: they both require a 4-word vector as a second argument. They are equivalent to tcgetattr and tcsetattr, respectively, but use a vector instead of struct termios to hold the four flag fields.

          • The error diagnostics still need some work—several different errors may be printed for the same line, and the line number is not always correct.

          • Indirectly assigning to a global variable will have strange results (e.g. foo = 40 is fine, but *&foo = 40 will actually set foo to 5, not 40). This issue does not affect local variable assignment, nor does it affect assignment to array indices (i.e. if foo is a global vector, foo[3] = 40 works as expected). The problem stems from a kludge which is necessary to achieve correct pointer arithmetic semantics.

          • A simple definition may contain at most one value in its initializer list. I have not yet found a reasonable way to implement the semantics described in section 7.1 of the manual; use a vector definition instead (e.g. foo[5] 1, 2, 3, 4, 5; instead of foo 1 2 3 4 5;). Incidentally, this same restriction seemed to be present in the H6070 implementation of B.

          • Global initializer lists may not contain strings or names of other globals (yet).



          Unlike ybc, these can both compile some original B programs.






          share|improve this answer
































            10














            This question has already been asked on Stack Overflow and answered, however we cannot show duplicated across sites. I will link to the answer there:



            https://stackoverflow.com/a/26247672/4370109



            Which says:




            Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc



            Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b) rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).



            Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.



            Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.







            share|improve this answer




















            • 2





              ybc can't compile contemporary programs, unfortunately.

              – wizzwizz4
              Apr 27 at 16:54






            • 4





              The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

              – Ross Ridge
              Apr 27 at 23:37






            • 1





              FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

              – Conor O'Brien
              Apr 28 at 3:51







            • 1





              @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

              – Leushenko
              Apr 28 at 10:15







            • 1





              I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

              – Joshua
              Apr 28 at 18:43


















            5














            Following links in issues for abc(https://github.com/aap/abc/issues/8) has led me to the The Amsterdam Compiler Kit(https://github.com/davidgiven/ack), which lists B as a supported language. It seems to have a more active user community, albeit focused on other languages it supports.






            share|improve this answer


















            • 1





              Great find! Welcome to Retrocomputing, and please read the tour.

              – wizzwizz4
              Apr 28 at 12:33











            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "648"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f10870%2fis-there-a-way-to-get-a-compiler-for-the-original-b-programming-language%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            11














            I found an LLVM-based implementation of Ken Thompson's PDP-11 flavour of B on GitHub: https://github.com/dobyrch/dbc and also an x86-based implementation of the Honeywell flavour: https://github.com/aap/abc. abc appears to have been reconstructed from documentation, and due to its x86 nature is a little hackish:




            Since B was first implemented for machines with word addressing, some hacking was required to make it work on the byte addressed x86. Addresses filled in by the linker are always byte addresses, so pointers to these addresses are collectively stored at the end of the .data section and are then converted to word addresses at runtime, before main() is called.



            The generated assembly is very inefficient, not even constant expressions are reduced at compile time. Also I/O is currently not buffered.




            However, dbc comes with its own issues:




            • All operators and statements are implemented, although they haven't all been thoroughly tested. I suspect some edge cases with oddly placed labels may generate invalid LLVM IR.

            • Every library function has been implemented, although gtty() and stty() differ slightly from their descriptions in the manual: they both require a 4-word vector as a second argument. They are equivalent to tcgetattr and tcsetattr, respectively, but use a vector instead of struct termios to hold the four flag fields.

            • The error diagnostics still need some work—several different errors may be printed for the same line, and the line number is not always correct.

            • Indirectly assigning to a global variable will have strange results (e.g. foo = 40 is fine, but *&foo = 40 will actually set foo to 5, not 40). This issue does not affect local variable assignment, nor does it affect assignment to array indices (i.e. if foo is a global vector, foo[3] = 40 works as expected). The problem stems from a kludge which is necessary to achieve correct pointer arithmetic semantics.

            • A simple definition may contain at most one value in its initializer list. I have not yet found a reasonable way to implement the semantics described in section 7.1 of the manual; use a vector definition instead (e.g. foo[5] 1, 2, 3, 4, 5; instead of foo 1 2 3 4 5;). Incidentally, this same restriction seemed to be present in the H6070 implementation of B.

            • Global initializer lists may not contain strings or names of other globals (yet).



            Unlike ybc, these can both compile some original B programs.






            share|improve this answer





























              11














              I found an LLVM-based implementation of Ken Thompson's PDP-11 flavour of B on GitHub: https://github.com/dobyrch/dbc and also an x86-based implementation of the Honeywell flavour: https://github.com/aap/abc. abc appears to have been reconstructed from documentation, and due to its x86 nature is a little hackish:




              Since B was first implemented for machines with word addressing, some hacking was required to make it work on the byte addressed x86. Addresses filled in by the linker are always byte addresses, so pointers to these addresses are collectively stored at the end of the .data section and are then converted to word addresses at runtime, before main() is called.



              The generated assembly is very inefficient, not even constant expressions are reduced at compile time. Also I/O is currently not buffered.




              However, dbc comes with its own issues:




              • All operators and statements are implemented, although they haven't all been thoroughly tested. I suspect some edge cases with oddly placed labels may generate invalid LLVM IR.

              • Every library function has been implemented, although gtty() and stty() differ slightly from their descriptions in the manual: they both require a 4-word vector as a second argument. They are equivalent to tcgetattr and tcsetattr, respectively, but use a vector instead of struct termios to hold the four flag fields.

              • The error diagnostics still need some work—several different errors may be printed for the same line, and the line number is not always correct.

              • Indirectly assigning to a global variable will have strange results (e.g. foo = 40 is fine, but *&foo = 40 will actually set foo to 5, not 40). This issue does not affect local variable assignment, nor does it affect assignment to array indices (i.e. if foo is a global vector, foo[3] = 40 works as expected). The problem stems from a kludge which is necessary to achieve correct pointer arithmetic semantics.

              • A simple definition may contain at most one value in its initializer list. I have not yet found a reasonable way to implement the semantics described in section 7.1 of the manual; use a vector definition instead (e.g. foo[5] 1, 2, 3, 4, 5; instead of foo 1 2 3 4 5;). Incidentally, this same restriction seemed to be present in the H6070 implementation of B.

              • Global initializer lists may not contain strings or names of other globals (yet).



              Unlike ybc, these can both compile some original B programs.






              share|improve this answer



























                11












                11








                11







                I found an LLVM-based implementation of Ken Thompson's PDP-11 flavour of B on GitHub: https://github.com/dobyrch/dbc and also an x86-based implementation of the Honeywell flavour: https://github.com/aap/abc. abc appears to have been reconstructed from documentation, and due to its x86 nature is a little hackish:




                Since B was first implemented for machines with word addressing, some hacking was required to make it work on the byte addressed x86. Addresses filled in by the linker are always byte addresses, so pointers to these addresses are collectively stored at the end of the .data section and are then converted to word addresses at runtime, before main() is called.



                The generated assembly is very inefficient, not even constant expressions are reduced at compile time. Also I/O is currently not buffered.




                However, dbc comes with its own issues:




                • All operators and statements are implemented, although they haven't all been thoroughly tested. I suspect some edge cases with oddly placed labels may generate invalid LLVM IR.

                • Every library function has been implemented, although gtty() and stty() differ slightly from their descriptions in the manual: they both require a 4-word vector as a second argument. They are equivalent to tcgetattr and tcsetattr, respectively, but use a vector instead of struct termios to hold the four flag fields.

                • The error diagnostics still need some work—several different errors may be printed for the same line, and the line number is not always correct.

                • Indirectly assigning to a global variable will have strange results (e.g. foo = 40 is fine, but *&foo = 40 will actually set foo to 5, not 40). This issue does not affect local variable assignment, nor does it affect assignment to array indices (i.e. if foo is a global vector, foo[3] = 40 works as expected). The problem stems from a kludge which is necessary to achieve correct pointer arithmetic semantics.

                • A simple definition may contain at most one value in its initializer list. I have not yet found a reasonable way to implement the semantics described in section 7.1 of the manual; use a vector definition instead (e.g. foo[5] 1, 2, 3, 4, 5; instead of foo 1 2 3 4 5;). Incidentally, this same restriction seemed to be present in the H6070 implementation of B.

                • Global initializer lists may not contain strings or names of other globals (yet).



                Unlike ybc, these can both compile some original B programs.






                share|improve this answer















                I found an LLVM-based implementation of Ken Thompson's PDP-11 flavour of B on GitHub: https://github.com/dobyrch/dbc and also an x86-based implementation of the Honeywell flavour: https://github.com/aap/abc. abc appears to have been reconstructed from documentation, and due to its x86 nature is a little hackish:




                Since B was first implemented for machines with word addressing, some hacking was required to make it work on the byte addressed x86. Addresses filled in by the linker are always byte addresses, so pointers to these addresses are collectively stored at the end of the .data section and are then converted to word addresses at runtime, before main() is called.



                The generated assembly is very inefficient, not even constant expressions are reduced at compile time. Also I/O is currently not buffered.




                However, dbc comes with its own issues:




                • All operators and statements are implemented, although they haven't all been thoroughly tested. I suspect some edge cases with oddly placed labels may generate invalid LLVM IR.

                • Every library function has been implemented, although gtty() and stty() differ slightly from their descriptions in the manual: they both require a 4-word vector as a second argument. They are equivalent to tcgetattr and tcsetattr, respectively, but use a vector instead of struct termios to hold the four flag fields.

                • The error diagnostics still need some work—several different errors may be printed for the same line, and the line number is not always correct.

                • Indirectly assigning to a global variable will have strange results (e.g. foo = 40 is fine, but *&foo = 40 will actually set foo to 5, not 40). This issue does not affect local variable assignment, nor does it affect assignment to array indices (i.e. if foo is a global vector, foo[3] = 40 works as expected). The problem stems from a kludge which is necessary to achieve correct pointer arithmetic semantics.

                • A simple definition may contain at most one value in its initializer list. I have not yet found a reasonable way to implement the semantics described in section 7.1 of the manual; use a vector definition instead (e.g. foo[5] 1, 2, 3, 4, 5; instead of foo 1 2 3 4 5;). Incidentally, this same restriction seemed to be present in the H6070 implementation of B.

                • Global initializer lists may not contain strings or names of other globals (yet).



                Unlike ybc, these can both compile some original B programs.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 27 at 16:54

























                answered Apr 27 at 16:01









                wizzwizz4wizzwizz4

                8,957642110




                8,957642110





















                    10














                    This question has already been asked on Stack Overflow and answered, however we cannot show duplicated across sites. I will link to the answer there:



                    https://stackoverflow.com/a/26247672/4370109



                    Which says:




                    Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc



                    Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b) rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).



                    Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.



                    Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.







                    share|improve this answer




















                    • 2





                      ybc can't compile contemporary programs, unfortunately.

                      – wizzwizz4
                      Apr 27 at 16:54






                    • 4





                      The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                      – Ross Ridge
                      Apr 27 at 23:37






                    • 1





                      FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                      – Conor O'Brien
                      Apr 28 at 3:51







                    • 1





                      @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                      – Leushenko
                      Apr 28 at 10:15







                    • 1





                      I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                      – Joshua
                      Apr 28 at 18:43















                    10














                    This question has already been asked on Stack Overflow and answered, however we cannot show duplicated across sites. I will link to the answer there:



                    https://stackoverflow.com/a/26247672/4370109



                    Which says:




                    Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc



                    Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b) rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).



                    Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.



                    Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.







                    share|improve this answer




















                    • 2





                      ybc can't compile contemporary programs, unfortunately.

                      – wizzwizz4
                      Apr 27 at 16:54






                    • 4





                      The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                      – Ross Ridge
                      Apr 27 at 23:37






                    • 1





                      FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                      – Conor O'Brien
                      Apr 28 at 3:51







                    • 1





                      @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                      – Leushenko
                      Apr 28 at 10:15







                    • 1





                      I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                      – Joshua
                      Apr 28 at 18:43













                    10












                    10








                    10







                    This question has already been asked on Stack Overflow and answered, however we cannot show duplicated across sites. I will link to the answer there:



                    https://stackoverflow.com/a/26247672/4370109



                    Which says:




                    Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc



                    Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b) rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).



                    Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.



                    Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.







                    share|improve this answer















                    This question has already been asked on Stack Overflow and answered, however we cannot show duplicated across sites. I will link to the answer there:



                    https://stackoverflow.com/a/26247672/4370109



                    Which says:




                    Prompted by this question, there is now a B compiler available from here: https://github.com/Leushenko/ybc



                    Runs on Windows, Linux, and OSX (binaries provided; in the spirit of the question it is written in an obscure language), where it produces very poor quality x86-32 assembly. Should be GCC-compatible. It is reconstructed out of the available reference material on B, and almost certainly does not reflect the language as it really was in the 1960s. Notably, in the absence of type information (B is untyped), the &a[b] == &*(a + b) rule can not hold on x86, meaning that this task is effectively impossible (without resorting to an interpreter).



                    Apart from that, Pavel Minaev's comment is right: the language as described is extremely small, far smaller than C, and an experienced/competent compiler programmer could likely write one for you in an afternoon.



                    Unfortunately this is only a partial answer, as I couldn't tell you where to find a good B compiler.








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 27 at 17:02









                    Nisse Engström

                    23727




                    23727










                    answered Apr 27 at 15:00









                    Brian Tompsett - 汤莱恩Brian Tompsett - 汤莱恩

                    1,605522




                    1,605522







                    • 2





                      ybc can't compile contemporary programs, unfortunately.

                      – wizzwizz4
                      Apr 27 at 16:54






                    • 4





                      The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                      – Ross Ridge
                      Apr 27 at 23:37






                    • 1





                      FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                      – Conor O'Brien
                      Apr 28 at 3:51







                    • 1





                      @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                      – Leushenko
                      Apr 28 at 10:15







                    • 1





                      I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                      – Joshua
                      Apr 28 at 18:43












                    • 2





                      ybc can't compile contemporary programs, unfortunately.

                      – wizzwizz4
                      Apr 27 at 16:54






                    • 4





                      The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                      – Ross Ridge
                      Apr 27 at 23:37






                    • 1





                      FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                      – Conor O'Brien
                      Apr 28 at 3:51







                    • 1





                      @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                      – Leushenko
                      Apr 28 at 10:15







                    • 1





                      I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                      – Joshua
                      Apr 28 at 18:43







                    2




                    2





                    ybc can't compile contemporary programs, unfortunately.

                    – wizzwizz4
                    Apr 27 at 16:54





                    ybc can't compile contemporary programs, unfortunately.

                    – wizzwizz4
                    Apr 27 at 16:54




                    4




                    4





                    The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                    – Ross Ridge
                    Apr 27 at 23:37





                    The answer is wrong about one point.&a[b] == &*(a + b) can hold on x86 without an interpreter. You just need divide addresses by 4 when taking the address of something and multiply them by 4 when dereferencing them. Initialization of global variables is the only problem, you'd likely have to generate code initialize them like with C++ classes.

                    – Ross Ridge
                    Apr 27 at 23:37




                    1




                    1





                    FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                    – Conor O'Brien
                    Apr 28 at 3:51






                    FWIW, you can run B code online (uses the linked repo as a base) via Try it Online

                    – Conor O'Brien
                    Apr 28 at 3:51





                    1




                    1





                    @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                    – Leushenko
                    Apr 28 at 10:15






                    @RossRidge it can hold as long as your code doesn't want to interact with values from outside the program, i.e. libc. As soon as you want to call a function like malloc, without type information, B doesn't know whether to divide the return value by four or not. An FFI wrapping all external C functions could fix this, of course.

                    – Leushenko
                    Apr 28 at 10:15





                    1




                    1





                    I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                    – Joshua
                    Apr 28 at 18:43





                    I can make the &a[b] == &*(a + b) identity hold by assembling a[b] as follows (assuming extrn a,b): mov rsi, [a] ; add rsi, [b], mov rax, [rsi * 8]. That is, we store word addresses and convert word addresses to byte addresses at de-reference time. I can't be bothered to write yet another b compiler though.

                    – Joshua
                    Apr 28 at 18:43











                    5














                    Following links in issues for abc(https://github.com/aap/abc/issues/8) has led me to the The Amsterdam Compiler Kit(https://github.com/davidgiven/ack), which lists B as a supported language. It seems to have a more active user community, albeit focused on other languages it supports.






                    share|improve this answer


















                    • 1





                      Great find! Welcome to Retrocomputing, and please read the tour.

                      – wizzwizz4
                      Apr 28 at 12:33















                    5














                    Following links in issues for abc(https://github.com/aap/abc/issues/8) has led me to the The Amsterdam Compiler Kit(https://github.com/davidgiven/ack), which lists B as a supported language. It seems to have a more active user community, albeit focused on other languages it supports.






                    share|improve this answer


















                    • 1





                      Great find! Welcome to Retrocomputing, and please read the tour.

                      – wizzwizz4
                      Apr 28 at 12:33













                    5












                    5








                    5







                    Following links in issues for abc(https://github.com/aap/abc/issues/8) has led me to the The Amsterdam Compiler Kit(https://github.com/davidgiven/ack), which lists B as a supported language. It seems to have a more active user community, albeit focused on other languages it supports.






                    share|improve this answer













                    Following links in issues for abc(https://github.com/aap/abc/issues/8) has led me to the The Amsterdam Compiler Kit(https://github.com/davidgiven/ack), which lists B as a supported language. It seems to have a more active user community, albeit focused on other languages it supports.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 28 at 9:57









                    Syfer PolskiSyfer Polski

                    511




                    511







                    • 1





                      Great find! Welcome to Retrocomputing, and please read the tour.

                      – wizzwizz4
                      Apr 28 at 12:33












                    • 1





                      Great find! Welcome to Retrocomputing, and please read the tour.

                      – wizzwizz4
                      Apr 28 at 12:33







                    1




                    1





                    Great find! Welcome to Retrocomputing, and please read the tour.

                    – wizzwizz4
                    Apr 28 at 12:33





                    Great find! Welcome to Retrocomputing, and please read the tour.

                    – wizzwizz4
                    Apr 28 at 12:33

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Retrocomputing Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f10870%2fis-there-a-way-to-get-a-compiler-for-the-original-b-programming-language%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                    Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                    Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020