OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 9:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Good recources on creating programing languages/compilers?
PostPosted: Mon Apr 03, 2017 7:13 pm 
Offline

Joined: Mon Apr 03, 2017 6:49 pm
Posts: 1
Hey, I know this is probably a really idiotic question to ask but does anyone here know any good recourses on making a custom programing language/compiler? I have made a simple scripting language for my up-coming OS and I plan to have a compiler for it. It probably wont help much but here is some sample code:

Code:
~/Comments are enclosed in '~/' and ended in '/~'. Can be multi-line /~
req 'path/to/api'        ~/ Loads an API /~
bool t set True          ~/ Sets a Boolean variable 't' to True /~
~/ Variable types are integer(int), float(flt), Boolean(bool), character(char) and memory address (mem) ~/


IF(t) START    ~/ If t is true it will execute the code ?/~
~/ Stuffs to do... /~
ELIF(1<2)      ~/ IF the if statement was false it checks this /~
~/ Stuffs to do... /~
ELSE              ~/ If no statement is true then it runs this /~
~/ Stuffs to do... /~
END


Thank you in advance


Top
 Profile  
 
 Post subject: Re: Good recources on creating programing languages/compiler
PostPosted: Mon Apr 03, 2017 8:29 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
I would like to recommend our sister site, Compilerdev.org, and its companion forums. It is still a very new site, so the resources are limited so far, but it is probably the best place at the moment.

You could also try the old USENET newsgroup comp.compilers as well (it is mirrored through Google Groups if you don't have a feed), but I have no idea how active it is or how much spam it gets these days (I should probably check, actually). I am pretty sure it is moderated, so junk posts shouldn't be too much of an issue, but volume may be another matter (EDIT: yes, I just checked, it is moderated, and it does seem active if a bit slow; however, it is dominated by experienced compiler designers and academic researchers - which is good to see, by my count, but probably not what you needed).

There are numerous books on the subject, and while public libraries are unlikely to have anything much on the topic (or if they do, it is likely to be a SAMS junkheap - did they ever actually publish a book on that? - or possibly something really dated like A Small C Compiler), most college or university libraries will have, at the very least, a copy of the venerable Dragon Book, and usually at least some of the older texts for less academic audiences such as Introduction to Compiler Construction, Crafting a Compiler in C, Compiler Design in C, or an earlier edition of Writing Compilers and Interpreters: A Software Engineering Approach. Better stocked libraries may also have Engineering a Compiler and/or Modern Compiler Design, both of which are (IMAO) better written, easier to follow, and more up to date than the 3rd edition of the Dragon Book (OK, technically not third ed, but they changed the title after the first one, so...). Even a moderately sized university is likely to have both.

There are any number of other books on the subject, but the values of them are going to be hit and miss, and which one will work best for you is something no one can say until you try them.

If I had to recommend one, I would say Modern Compiler Design, but it you may find it a tough nut to crack; it is at least as academically oriented as Aho and Ullman, even if it is more engagingly written. Mak's Writing Compilers and Interpreters makes for a much gentler learning curve, but it's not nearly as comprehensive. You might want to try Mak first, then go with Grune et. al. for more advanced material if you need or want to later.

You might also want to look at books specifically on 'scripting languages' (which usually means either a shell command language such as BASH shell, or an interpreted/compile-and-go swiss-army-knife like Perl or Python), such as Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages, though both Mak and Grune discuss interpreters to some degree as well.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Thu Apr 06, 2017 1:44 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: Good recources on creating programing languages/compiler
PostPosted: Mon Apr 03, 2017 9:07 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
OK, why do I always do this? I spent over an hour tweaking my post after I initially posted it. I am guessing the the OP has already read the older version, and may never see the new edits. Me R Dah Dumas.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Good recources on creating programing languages/compiler
PostPosted: Thu Apr 06, 2017 2:21 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 21, 2011 9:47 pm
Posts: 286
Location: Tustin, CA USA
Also, I like Flex & Bison as a tutorial on how to use the respective tools.

_________________
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group