Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Workspaces Forum
  4. Creating a new programming language from scratch?

Creating a new programming language from scratch?

Scheduled Pinned Locked Moved Workspaces Forum
javabusinessquestionlounge
3 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Siegfreide
    wrote on last edited by
    #1

    I'd like to know if anyone has any suggestions regarding how someone would go about writing a new language from scratch, then using this language to create its own compiler. I've been entertaining the idea of writing my own language, mainly because I find pretty much every other language unreadable in terms of syntax choices, and overall visual representation of the code. My own experience with coding is limited, with most of my experience being in GML (GameMaker Language), and I've started picking up on Java. I was really impressed with GML's syntax and loose variable declaration, but to my knowledge it cant be used to create general computer software. When I started Java, however, I was completely turned off to its formatting requirements and syntax. Basically, I would like to create an easily read all-purpose language, and I'd like to try to combine all of the "pros" of the most popular languages, while eliminating as many of the "cons" as possible.

    J 1 Reply Last reply
    0
    • S Siegfreide

      I'd like to know if anyone has any suggestions regarding how someone would go about writing a new language from scratch, then using this language to create its own compiler. I've been entertaining the idea of writing my own language, mainly because I find pretty much every other language unreadable in terms of syntax choices, and overall visual representation of the code. My own experience with coding is limited, with most of my experience being in GML (GameMaker Language), and I've started picking up on Java. I was really impressed with GML's syntax and loose variable declaration, but to my knowledge it cant be used to create general computer software. When I started Java, however, I was completely turned off to its formatting requirements and syntax. Basically, I would like to create an easily read all-purpose language, and I'd like to try to combine all of the "pros" of the most popular languages, while eliminating as many of the "cons" as possible.

      J Offline
      J Offline
      J Adam Armstrong
      wrote on last edited by
      #2

      For a self compiling compiler, you should have your compiler: A: LLVM (seems to be the easiest for machine code right now) for a backend B: Target a virtual machine (e.g. JVM or .NET) that has the features you need C: Translate code to an existing language that runs on platforms you care about (Like the first C++ compiler generated C code) For any programming language, you will need to write a parser. I prefer inline PEG parsers (like Boost Spirit and Parslet) over parser generators. Having a lexical analyzer can make parsing a lot easier when, but it is not required. If you are planning on making a serious language that you want other people to use, read this article. Popular languages that are not aiming to be a C/C++ replacement tend to converge to a hybrid of Lisp and Smalltalk but with a better syntax. So look those up to get good foundation, and while researching Lisp you may also want to look at Scheme and Kernel. Maybe Prologue as well, since it is so different and therefore might help with inspiration. Finally, lambda-the-ultimate.org is a good place to look for stuff on programming language theory and design. P.S. Making a language is a long and involved process if you want to make a good one.

      K 1 Reply Last reply
      0
      • J J Adam Armstrong

        For a self compiling compiler, you should have your compiler: A: LLVM (seems to be the easiest for machine code right now) for a backend B: Target a virtual machine (e.g. JVM or .NET) that has the features you need C: Translate code to an existing language that runs on platforms you care about (Like the first C++ compiler generated C code) For any programming language, you will need to write a parser. I prefer inline PEG parsers (like Boost Spirit and Parslet) over parser generators. Having a lexical analyzer can make parsing a lot easier when, but it is not required. If you are planning on making a serious language that you want other people to use, read this article. Popular languages that are not aiming to be a C/C++ replacement tend to converge to a hybrid of Lisp and Smalltalk but with a better syntax. So look those up to get good foundation, and while researching Lisp you may also want to look at Scheme and Kernel. Maybe Prologue as well, since it is so different and therefore might help with inspiration. Finally, lambda-the-ultimate.org is a good place to look for stuff on programming language theory and design. P.S. Making a language is a long and involved process if you want to make a good one.

        K Offline
        K Offline
        Kamil Burzynski
        wrote on last edited by
        #3

        This is not the right forum, but once this topic is here already, I would suggest you to read the dragon book: Compilers: Principles, Techniques, and Tools[^]. It will point you in the right direction and give solid base for your effort.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups