Hey people, I'm new to this forum and I have a question..
Notepad++ lets you define custom programing languages in the IDE, however I was wondering if it would be possible to create a configurable interpreter for the custom language that breaks it down to C++/C#? I'f it is possible I would love to know how!
The forum has been archived
While the forum may not be active, the community still lives on Discord! Click here to join us.
While the forum may not be active, the community still lives on Discord! Click here to join us.
Notepad++ Custom Language Interpreter?
- UC101
- Member
- Posts: 71
- Joined: January 15th, 2014, 10:33 pm
Notepad++ Custom Language Interpreter?
We are anomalous.
We are region.
Forgive and forget.
Expecto patronum.
We are region.
Forgive and forget.
Expecto patronum.
- Entity
- Editorial Staff
- Posts: 3097
- Joined: November 29th, 2012, 9:41 pm
- Design Competitions Voted: 1
Before I try and answer, let me make sure I understand your question:
- You're writing a programming language (I'll refer to it as "Derp" for clarity)
- "Derp" doesn't compile directly to an EXE
- You want to write an interpreter to convert "Derp" sourcecode into C++/C# sourcecode
- Then you can compile the C++/C# code into an EXE
- kroltan
- Developer
- Posts: 285
- Joined: October 8th, 2012, 6:57 pm
- Design Competitions Voted: 1
No, that's not what Notepad++ does. All it does is highlight keywords in a pretty manner.
You'd use a Language Recognizer (a compiler compiler), such as ANTLR (with Java) or Irony (with .NET languages).
However, you'd still need to program the behaviours of your language using the languages inside the parentheses.
You'd use a Language Recognizer (a compiler compiler), such as ANTLR (with Java) or Irony (with .NET languages).
However, you'd still need to program the behaviours of your language using the languages inside the parentheses.
- Entity
- Editorial Staff
- Posts: 3097
- Joined: November 29th, 2012, 9:41 pm
- Design Competitions Voted: 1
- UC101
- Member
- Posts: 71
- Joined: January 15th, 2014, 10:33 pm
I knew It wasn't possible with notepad++ I was just asking if there were any programs to turn my custom syntax into an interpreter and or compilerEntity wrote:Like Kroltan said, that's not possible with Notepad++. You can either write the interpreter manually, or use the libraries Kroltan suggested. Either way it's going to be somewhat of a hassle, depending on how complex your language is
Notepad++ is just a text editor though.
We are anomalous.
We are region.
Forgive and forget.
Expecto patronum.
We are region.
Forgive and forget.
Expecto patronum.
- kroltan
- Developer
- Posts: 285
- Joined: October 8th, 2012, 6:57 pm
- Design Competitions Voted: 1
Yeah, the closest you can get is with one of those libraries, where you define rules to parse the code, then you can act accordingly. An example in ANTLR for a simple math language supporting all the basic opeerations, but only one at a time (example use: calculators):
(See ANTLR's website for more info)
It would parse a string into a tree you can go trough with Java code. Example:
3.14159 * -1
Would turn out into this object tree (visualized):
V indicates the value of the token
Code: Select all
grammar SimpleMath;
Operator: ('+' | '-' | '/' | '*');
Number: ('+' | '-')? [0..9]+ ('.' 0..9*)*;
Statement: Number Operator Number;
It would parse a string into a tree you can go trough with Java code. Example:
3.14159 * -1
Would turn out into this object tree (visualized):
V indicates the value of the token
Code: Select all
Statement
/ | \
Number Operator Number
V V V
3.14159 + -1