OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Feb 23, 2018 12:30 am

All times are UTC - 6 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 48 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: Public Domain C/C++ Compiler
PostPosted: Sun Jan 14, 2018 10:44 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1088
I've managed to implement more code for the main compiler loop. It actually has 3 loops (preprocessor, global declarations and local/function body declarations). Each loop has an outermost loop (mostly to stop each stage loop and to change/reopen files as directed by #includes and end of files), and an innermost loop, where the whole syntax tree will be, working as just a driver that calls the actual syntax OPCODE routines capable of interpreting/configuring/gathering/generating assembly code.

So I need to start by writing code to record the index of included source files and the line at which we need to switch to another, indicated, source file from index, where it was last left, so only ideas for the actual code, and writing/explaining code, will help at this point. I already have the idea of how to proceed, so I will simply add that code. By February the loops with the syntax tree skeletons should be well implemented only to complete/extend them towards the end of the year.

What I need to do next is writing a function that lets me see whether the first non-blank character in the current line is '#', and if so, see if it's an include directive, and then see if the file is enclosed in <> or "" to search for the included file in the corresponding compiler "include" or current source directories.



@Schol-R-LEA, you would probably thrive with cpudev.org if you dedicate this year entirely to a key topic on it, to be implemented as a practical thing to explain and use.

For example, I could suggest that you investigate personally how computers get to read ROM/RAM, and provide working schematics for ROM readers. For example, I find that modern computing at an understandable level by everyone starts with the Atari 2600, it has RAM, ROM, is simple and capable. So figuring out how the cartridges are read and building a working ROM dumper would be extremely valuable for learning how to access ever complex RAM/ROM in other architectures, but this one is so simple that anyone will be able to build it. Nobody said that you cannot sell a book about that and then put it in cpudev.org, or make YouTube videos about it and earn from that with Adsense, or both (books and YouTube/Adsense).

I've been investigating and building a socket for reading the 8 data lines and driving the address lines (11 or 12...) in the Atari 2600 cartridge, but I need to figure out how to do that using only parallel/serial ports, or looking for another way to build a simple cartridge dumper that can dump directly to the PC, simple in the sense that it's possible to see how the dumper is implemented from scratch to later learn how to build similar ROM memory controllers, not just using Arduino with prebuilt components since it seems that an Atari 2600 ROM dumper can be made with much less electronically.

_________________
http://devel.archefire.org/forum/
http://www.archefire.org/_PROJECTS_, http://sourceforge.net/u/udocproject/

YouTube Development Videos:
http://www.youtube.com/user/AltComp126/videos

IP for hosts file:
190.150.9.244 archefire.org (udocproject@yahoo.com)


Top
 Profile  
 
 Post subject: Re: Public Domain C/C++ Compiler
PostPosted: Sun Jan 14, 2018 11:24 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3050
Location: Chichester, UK
~ wrote:
What I need to do next is writing a function that lets me see whether the first non-blank character in the current line is '#', and if so, see if it's an include directive, and then see if the file is enclosed in <> or "" to search for the included file in the corresponding compiler "include" or current source directories.

Well that's a good five minute's work. You could have done that rather than making your last post.


Top
 Profile  
 
 Post subject: Re: Public Domain C/C++ Compiler
PostPosted: Sun Jan 14, 2018 7:36 pm 
Offline
Member
Member

Joined: Mon Jul 25, 2016 6:54 pm
Posts: 73
Location: Adelaide, Australia
~ wrote:
What I need to do next is writing a function that lets me see whether the first non-blank character in the current line is '#', and if so, see if it's an include directive, and then see if the file is enclosed in <> or "" to search for the included file in the corresponding compiler "include" or current source directories.

Do you plan on implementing the entire C preprocessor like this, or is this only for includes? Either way, I would seriously second (third, forth, ...) the suggestion to implement a general purpose tokenizer, and then apply logic like this to streams of tokens instead of raw text.
~ wrote:
@Schol-R-LEA, you would probably thrive with cpudev.org if you dedicate this year entirely to a key topic on it, to be implemented as a practical thing to explain and use.

glauxosdever made cpudev.org, not Schol-R-LEA, glauxosdever said that Schol-R-LEA wrote a lot for compilerdev.org, not cpudev.org. You really need to read posts, like, really. Please read and understand the posts. This isn't a blog, hearing what others are saying is an important part of using a forum.
Also you're basically telling Schol-R-LEA that he should write a tutorial to teach you personally how to make a ROM dumper for an Atari 2600. Why would he want to do that, why would he dedicate one of the 60 or so years of his adult life helping you make images of programs for a 40 year old PC?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 48 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 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