Skip to content

GOTO & Turing Completeness #1

@orchid-hybrid

Description

@orchid-hybrid

Hi,

I added labels (:label) and 'get label address' (!label) and then wrote in chicken scheme an assembler compiles them into pure MNNBFSL:

https://gist.github.com/orchid-hybrid/29cd05db345d17f80de5

label addresses are computed in binary:

#;5> (begin (push-binary 4) (newline))
[<[-"]"+[->+<"]+[-"][]"[->+<"]+[-"][]"[->+<"]+[-"][]
#;6> (begin (push-binary 5) (newline))
[<[-"]"+[->+<"]+[-"][]"[->+<"]+[-"][]"+[->+<"]+[-"][]
#;7> (begin (push-binary 6) (newline))
[<[-"]"+[->+<"]+[-"][]"+[->+<"]+[-"][]"[->+<"]+[-"][]
#;8> (begin (push-binary 7) (newline))
[<[-"]"+[->+<"]+[-"][]"+[->+<"]+[-"][]"+[->+<"]+[-"][]

The assembler must be careful to allocate enough space for printing out binary codes when calculating addresses.


Given that we have stack operations, +, *, swap and goto as well as conditionals it shouldn't be hard to build a simulator for a Turing complete language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions