Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,199,062 members, 7,970,274 topics. Date: Wednesday, 09 October 2024 at 04:59 AM |
Nairaland Forum / Science/Technology / Programming / Compiler Construction: Design A Scanner (2863 Views)
Java online compiler for swing programs / Pls Help, Website For C/c++ Compiler Free Download Windows 7 / Facebook Releases A Php Just-in-time Compiler (2) (3) (4)
Compiler Construction: Design A Scanner by chatykrew(m): 8:00pm On Mar 10, 2007 |
Hi guys, its great that there is a site like nairaland. More grease to the owners. Well i dont know whether this is the right place to ask this question with regards to compiler. but i hope someone can help or direct me to a site that might help. Design a scanner for the following instruction A=:B+10*(C-D) write a program to simulate the action of the above state diagram Thanks |
Re: Compiler Construction: Design A Scanner by Nobody: 8:33am On Mar 22, 2007 |
Compiler construction isn't beans. I'm doing it here, and even the foreign students are moaning in agony. Didnt mean to scare you. I think you'd need a good book, or search for tutorials on the net. As to your question, Im assuming you already have rudimentary knowledge of compilers. A scanner is a lexical analyser, and its responsible for breaking your input string into tokens. So A+B fed as input to your scanner should produce tokens "A", "B" and "+" So you need to : First change the expression to reverse polish (or postfix notation) if i'm not mistaken. So if you have an expression like A+B, it becomes AB+. You can google up some code snippets to do that i suppose. So your program should be able to 1. Read the input as a string i.e A+B 2. Break it down into tokens AB+ (changing it to reverse polish notation) 3. If i were you, a quick programming jutsu (yes I like naruto ) would be to store the reverse polish stuff in a char array, then copy them into another array, with a whitespace in between them. But Id advise you to read it up and not tjust blindly take my word for it. cheers |
Re: Compiler Construction: Design A Scanner by gurmen(m): 8:41pm On Mar 23, 2007 |
Hello, i'm a new member. I need materials on Compiler contruction. |
Re: Compiler Construction: Design A Scanner by DJNiyi(m): 2:37pm On Mar 24, 2007 |
Wavemasta is pretty much on point there. chatykrew, lexical analysis is the first part but then you have to do syntax analysis, semantic analysis and object code generation and optimization. Are you required to do this as well? This topic creates a lot of nostalgia so if you can you give us an idea of the whole project, I'm sure some of us will be able to help/guide you. For example, does your uni or college list the details of the assignments on a project page? If so, send us the link. Regards |
(1) (Reply)
Ipnx Wireless Internet Flaws! / A Simple And Very Useful -WORD And SENTENCE- Similarity Algorithm ...part_1 / I Need Internet Download Manager Serial Number.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10 |