Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hey guys,

i have finnished my programming language, but the problem is that i have it in a console application. you type in your code in a console application and then it runs it. i want to be able to have a windows forms application open, type in code into a textbox called 'txtInput' and then it opens a console application and runs the code from 'txtInput' in the console. is this possible? if so, can you please give me an example code and explain it to me?
Posted
Comments
Richard MacCutchan 11-Jun-12 4:34am    
It's impossible to give you a full solution in a forum such as this. Go and read some articles (here on CodeProject) about Windows forms and try developing according to your requirements.
Sergey Alexandrovich Kryukov 11-Jun-12 19:33pm    
It's not really related to Forms or something else. The real issue is the property of the languages -- can it be uses as a compiled languages or not?
Please see my answer where I try to explain it.
--SA
Richard MacCutchan 12-Jun-12 3:55am    
I think you have misunderstood the question.
MarqW 11-Jun-12 6:35am    
Could you not change your lanuage to read code from files instead of the console? Then you'd be able to use any existing text editor (in addition to writing your own, if you still wanted)
Sergey Alexandrovich Kryukov 11-Jun-12 19:33pm    
It may or may not be possible -- please see my answer.
--SA

1 solution

Please see the comments to your question.

Apparently, your language is not used as a compiled language, but you want to add the compilation. It's important to understand that not all languages allow compilation. It totally depends on the properties of a language itself.

Compilation is possible for a broad class of languages called "compiled languages", please see:
http://en.wikipedia.org/wiki/Compiled_language[^].

As we are not familiar with the properties of your languages, it's impossible to answer if it allows compilation or not.

It's interesting to note that, by the nature of CLR, all .NET languages are compiled. Their compilers compile the source code to Common Intermediate Language (CIL); and CIL is compiled to the instruction-set code during execution; normally on the per-call basis. This is true even for .NET languages based on a formerly interpretive languages, such as PHP.

Please see:
http://en.wikipedia.org/wiki/Compiled_language[^],
http://en.wikipedia.org/wiki/Interpretive_language[^],
http://en.wikipedia.org/wiki/Common_Language_Runtime[^],
http://en.wikipedia.org/wiki/Common_Intermediate_Language[^],
http://en.wikipedia.org/wiki/.NET_languages[^],
http://en.wikipedia.org/wiki/Phalanger_%28compiler%29[^] (an example: PHP for .NET).

I would advise you try to create compiled languages. With .NET, this is much easier to do, because you can compile your code directly to CodeDOM, so you don't have to take care about the detail of code generation.

Please see:
http://msdn.microsoft.com/en-us/library/650ax5cx[^],
http://msdn.microsoft.com/en-us/library/650ax5cx[^],
http://msdn.microsoft.com/en-us/library/ms404261[^].

—SA
 
Share this answer
 
v2
Comments
MarqW 12-Jun-12 3:45am    
It's a useful post, but not really relevant to the question asked. The OP was not asking preferences on languages, compiled or not. They were asking how to write text to a console mode application
Sergey Alexandrovich Kryukov 12-Jun-12 9:56am    
Can you read, honestly? What you describe is what OP already has -- read again. And what am I writing about is NOT "preferences on languages". Please read again and be more careful.
--SA
MarqW 12-Jun-12 10:01am    
I can read pretty well, thank you. The OP has a programming language that takes console text input. What they have asked for is a way to write an application with a textbox that sends text from that textbox to the console as input to the programming language. There is *no* reference to wanting to "compile" the text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900