making a compiler

Started by
27 comments, last by jumpjumpjump 20 years, 1 month ago
Way don''t use tcl?
http://www.cis.gsu.edu/~shong/oojokes/
Advertisement
This is from a class i''m taking right now.

http://www.masda.vxu.se/multimedia/datalogi/compiler/index.htm
______________________________Only dead fish go with the main-stream.
Thanx for ur quick responses!
What I am quite confused now is whether it is possible to write a script engine without generating the intermediate code, machine code and creating my own virtual machine. I m now finding it''s quite hard to deal with the condition statement, while loop statement without using any assembly-like language and creating my own VM. I just want to know whether it''s "theoretically" possible.
anybody help me please?
quote:Original post by Ekas78
This is from a class i''m taking right now.

http://www.masda.vxu.se/multimedia/datalogi/compiler/index.htm


Hi, Ekas,
are u asked to write a VM by ur own? do u have any assignment for this course?

Google for jack crenshaw''s compiler tutorials. That will get you started on a simple compiler. But I have to warn you, writing a scripting system is no easy task. I''ve made a few in the past but the only one I ever finished had a simple assembly-like syntax.

If you''re getting serious about it, look into lex+yacc (or flex+bison) and consider buying the Dragon book.
Thanx for the info ,blueEbola,
I checked it out, I noticed that in the tutorial, he also used a VM and generate some assembly-like language.
Actually I have done my own compiler before, i know it would be a tedious and huge work. I was provided a VM at that time, and I generated the MIPS code while parsing the program, after that the MIPS code was executed by the VM which simulated a CPU with 32 registers (i guess it''s a stack-based VM, not efficient though). however, i m now asked to write a compiler without a VM, and I have no idea how to implement the internals of the compiler just by adding some C++ code in the action part of the grammar file, seems impossible
btw, the compiler I m working on now is basically of the C++ syntax
Actually we are supposed to write a simple VM stack machine. Nothing fancy or so but it''s a start.

check this out might help:
http://www.masda.vxu.se/~jonasl/dac718/

Check under "code assignments" (not written assignments)

quote:Original post by fuqihao
quote:Original post by Ekas78
This is from a class i''m taking right now.

http://www.masda.vxu.se/multimedia/datalogi/compiler/index.htm


Hi, Ekas,
are u asked to write a VM by ur own? do u have any assignment for this course?



______________________________Only dead fish go with the main-stream.
quote:Original post by jumpjumpjump
I am working on making my own scripting language thing and I want to know if there is any way to write a compiler for it in VB.NET, is there and what are some good resources on making compilers? I have a few bookmarks on flipcode. i also have some C++ knowledge, if that helps.

Boo!! I know all.



umm you are using VB.NET yet you want to write your own full language? what is the point?

With C# and VB.NET (at least I believe VB can do this) you can use reflection and codedom to have your scripts compile on the fly. This way you can use either C# or VB syntax.

[edited by - Imperil on March 4, 2004 3:27:26 PM]

This topic is closed to new replies.

Advertisement