Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do i make a compiler?
#1
so yeeterday i watched this pyhton playlist https://www.youtube.com/watch?v=RjScQkED...TEt4gUrzeO and i think Im good enough now at programming so i thinked why I dont make a littel compiler?just to pracectis and see how my current programming skills are
do somebody knows how i can make a compilre? Please give a bit code

thanks in advance **biggrin** **biggrin** **biggrin**
Reply
#2
I think the first step would be to decide how much you want to do. Do you want to write a parser? What do you want to compile your language to? Assembly? LLVM IR? A different language?

There are very good tools for parsing/lexing a language for you, to help cut some of the steps out. You'll probably want to use either PLY or Antlr.
http://dabeaz.com/ply/
https://www.antlr.org/

There's a great free book, that's still being written, that goes through the process of writing an interpreter: http://craftinginterpreters.com/
It uses Java, however, instead of Python.

The Original book, the Dragon book, is what was (...and might still be?) used to teach compiler theory in colleges such as MIT: https://www.amazon.com/dp/0321486811

Stack Overflow also tells me that this book is highly recommended: https://www.amazon.com/dp/0471976970
Reply
#3
Aho's book was my bible.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  When does Python need to use a compiler? JanOlvegg 5 3,008 Mar-09-2023, 04:24 PM
Last Post: snippsat
  Compiler wallgraffiti 3 2,299 Aug-21-2020, 06:57 AM
Last Post: Gribouillis
  f2py: no Fortran compiler found FMJS 2 5,399 May-25-2020, 02:51 PM
Last Post: FMJS
  pip 2.7 problem with compiler aster 2 2,746 Dec-25-2019, 06:16 PM
Last Post: aster
  Compiler fault or some kind of weird referencing bug? Joseph_f2 11 9,145 May-09-2017, 08:50 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020