Compiler project 1.0.0 | SoloLearn: Learn to code for FREE!

+6

Compiler project 1.0.0

yet another exciting project, i have being assigned a project to build a simple compiler in c++, i dont know how simple it has to be, how should the blue print of my compiler look like? i just need help with general ideas in developing the compiler. what are the common tools i need for this project to be a success??

8/28/2017 6:40:18 PM

Zion Coder

23 Answers

New Answer

+8

join our project : https://code.sololearn.com/W9G1YlB8mozL/?ref=app else 1 what do you mean by compiler? even python has a compiler 2 a assuming to assembly compilers, b assuming you know assembly see your target platform. as you will have to deal with assembly, you might want to see how assembly works and link on different platforms 3 if simple, you might want to write your own lexer 4 if simple, your own parser is fun i can continue but please give more info particularly 1

+8

You could use the YACC (Yet Another Compiler Compiler) and LEX (Lexical Analyzer) tools to build your first compiler. http://dinosaur.compilertools.net http://tldp.org/HOWTO/Lex-YACC-HOWTO-5.html

+8

@Abdur, in a very simple expression evaluator that calculated a math expression. I have a code on SL that uses a lexer and a parser that does just that. I had to convert BNF syntax to create a recursive descent parser which is based in part on the code I have studied with YACC.

+7

@Germain in that case you need a good brush up on compiler design / compiler theory tutorials point just revamped it's section check that out else, i made a small tuto series : https://www.sololearn.com/Discuss/549601/?ref=app take a look ! our hub? it's on discord

+7

@Abdur, what do you mean by that? ☺

+7

1 have you used lex or yacc? @Karl?

+7

@Abdur, yes a long time ago.

+7

+7

@Abdur, yeah why?

+7

so, in what context, which lang? @Karl

+7

no good @Germain these tools are good but worthless if you don't understand what you are doing

+7

@Abdur, you're right I guess. Just tought studying code generated from those tools could have helped.

+7

i saw the link you posted, it explains the steps, how things get done but someone might think that lex == lexical analysis i.e. that lex analysis cannot be performed without lex

+6

@karl T lol lexer and yacc it's easy to say while you increase the learning curve of the beginner trite

+6

@Karl look you know what a recursive descent parser but did not see it fit that the asker might study those things you straight suggested the use of tools you did not care to assess the level of knowledge of the asker you did well, just pointing out ... a point

+5

Maybe this could help https://www.sololearn.com/discuss/540958/?ref=app

+4

@Abdur is it a complicated approach? i mean using lexer and yacc as a basic tool to learn compiler development

+4

@Abdur that's true, maybe Karl can share his experience

+3

@Abdur give me tips on writing a simple parser and lexer

+3

@Karl thanks for tips