IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

compiler construction chat


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Oct 03, 2011 10:58 pm
Reply with quote

Thanks Enrico :-)
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Oct 05, 2011 11:13 pm
Reply with quote

Find the crenshaw manual quite intresting but the compiler I got doesnt throw whats the error icon_sad.gif is that because I use free pascal??


Should I start with pascal or ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 05, 2011 11:21 pm
Reply with quote

some time ago I played with it using free pascal and I do not remember having any trouble

what version of the crenshaw stuff did You find the zipped one in text format ?
or You are typing from scratch using the PDF one
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Oct 05, 2011 11:49 pm
Reply with quote

I am typing from the scratch using pdf foercasting these syntax will go to my head icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 05, 2011 11:59 pm
Reply with quote

I just remembered about the wayback machine
and ... tah tah

web.archive.org/web/20110725224253/http://compilers.iecc.com/crenshaw/

and remember
Code:
http://www.archive.org/web/web.php


great for finding disappeared web pages

and in case You have trubles getting there

here is attached the crenshaw-txt.zip
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Oct 06, 2011 12:20 am
Reply with quote

Thanks Enrico :-) and to be frank with you Crenshaw's language is a bit high as for me to comprehend anyway am googling to get more info icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Oct 06, 2011 12:30 am
Reply with quote

well it' s some kind of religion war
top down parsing
and LALR parsing - flex bison semi BNF

You might ry a different path as ..
start exercising with flex a bit of patten matching
after that continue with bison ( the simple calculator )

what You get by building the simple calculator is an interpreter ,
after that expanf the calculator with simple if logic
and ...
and ...
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Oct 06, 2011 12:36 am
Reply with quote

Can you guide me to some good mauals for BISON or FLEx ?

Never heard of them before icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Oct 06, 2011 12:57 am
Reply with quote

for bison the official GNU manual here
www.gnu.org/software/bison/manual/
and here the same for flex
flex.sourceforge.net/manual/

anyway I got curious, reinstalled everything from scratch
and everything worked up to tutor5

to save some typing

I would start with the old lex and yacc downloading the sources of the examples from the o' reilly site here
shop.oreilly.com/product/9781565920002.do
and click on the Download Example Code
it will keep You busy for a while
after You have mastered the examples You will be ready for the next step
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Oct 06, 2011 1:03 am
Reply with quote

Thanks Enrico:-)
Back to top
View user's profile Send private message
mtaylor

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Sat Oct 15, 2011 10:52 pm
Reply with quote

I've spent a lot of time with the parsing bit of compiler impl. Here's my take on the resources mentioned so far:

Dragon Book: all theory, I didn't find it very useful. Yeah it's good to know, but if you aren't implementing lexers and LALR parser generators it's a bit much. The lex/yacc tutorial linked above is a good intro, but to use the tools you'll be coding in C. The dual stack nature of table driven yacc parser can be hard to grasp at first

Crenshaw: goes thru building recursive descent parsers. It's a bit long winded because he goes thru and rewrites the same parser several times, but it's a good intro to dop down parsing. ANTLR is the current popular recursive descent parser generator, Javacc and Coco/R also good alternatives.

FWIW, recursive descent is used a lot because it provides a lot more flexibility in parsing languages like C++ which is very difficult (many ph.d thesis have been written about parsing c++). For example, llvm c/c++ frontend (clang) is a hand coded recursive descent parser.

Here's an exmple of a recursive descent parser in Python, includes an interpreter that walks the AST:

www.jroller.com/languages/entry/python_writing_a_compiler_and

But, parsing is only about 1/3 of a compiler, the other 2/3's are also very challenging (register allocation, code optimization, etc...)
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun Nov 06, 2011 9:31 pm
Reply with quote

Thanks Mtaylor icon_smile.gif

I have started with something which I have some idea on that is "C" If you experts can guide on path of that will be helpful icon_smile.gif
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Nov 08, 2011 3:47 pm
Reply with quote

enrico-sorichetti wrote:
...
another very interesting article with a completely different approach
is Jack Crenshaw' s Let' s build a compiler, with a PASCAL working sample
it was available until a few months ago at compilers.iecc.com/crenshaw/
but the IECC idiots deleted every trace of it
...

The Wayback Machine is your friend.
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Thu May 22, 2014 11:47 am
Reply with quote

To be honest, I was digging for gold; and guess I ended up with this post. icon_biggrin.gif
Thanks for the info Enrico; thats some good stuff there.
<bookmarked>
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Compiler and run JCL for basic PL/I p... PL/I & Assembler 10
No new posts Pre-Compiler Bug with DSNH520I message? DB2 1
No new posts pre-compiler for program in an HFS DB2 0
No new posts Who can recomend or to know a PL1 com... DB2 4
Search our Forums:

Back to Top