Umm. A couple of things. I think you should make strings be able to be in single our double quotes, just because so many people are so used to that. Also, instead of the @ symbol, PLEASE PLEASE PLEASE use escape characters ("\n"=newline "\t"=tab "\\"=\ "\0"=null "\""=" "\'"=' etc.) They are used for every computer language I've seen. (Python, Java, C++, C, Groovy, C#, Javascript, PHP, etc.) Finally, methods can return a value. If they don't want to, then the return type is void.
Going in order: -I suppose I could use both, but it's just hitting the key associated with both once easier quicker than holding shift then hitting it? (Basically, isn't it easier quicker to just type a ' than a ") -I'll use the escape character for the single quote, but I had already planned to implement it for other characters like tab, line feed, etc. -I've never seen something like "private void something() { /*code*/; return void; }". To me, methods and functions are different. "private void" would be a method, and "private <any type other than void>" would be a function.
Agreed. I think the C style of quotes, where single quotes are for a single character, literally replacing it in the program with the ASCII constant, and double quotes for strings, works better, rather than not differentiating between the two, though.
But honestly, how often do you use a char literal? (I'm not being a smart-ass, I really want to know ) I might implement the char type for shiggles, but I don't even know how often it's used.
Well, when I wrote something like "([arguments])", I meant that the "arguments" part was optional, but I like that idea . The only thing I'd change would be the array part. It's going to be like VB (without the ability to change index numbers ), so it would be "int array1(5) = ([1][2][3][4][5]);" I'll also put in single line comments with "//".
Well right now the project name is Yanoopl (yet another object-oriented programming language), but for the name, the misspelling was intentional
The language will be compiled until I figure out how to add some sort of debugging system like Visual Studio and its breakpoints (because I'd imagine there's some interpreting there.)
I don't think this will be dropped. It will slow down when school starts and pick up on breaks, but I think this is something that will definitely help with colleges and jobs in the future lol. Plus this is something I've been meaning to do for a while, and now I know how.
I'm not on a computer now, but I'll look at Haskell and your language when I am.
In case you haven't looked (or even glanced) at my signature, I'm writing an OOPL called Zenon. (In case you don't know what that means, it stands for Object-Oriented Programming Language.)
My only problem is: I'm terrible at coming up with syntax because I have no creativity The syntax I have right now looks cool, but it's impractical. It requires more unnecessary typing than I'd like.
This language will be .NET-based, so anything you can do in C# or VB, you'll be able to do in this. This includes designing forms, creating console-based applications, and probably libraries (.dll's) for use with other, non-Zenon programs. My request to you, the Omnimaga community, is to help construct a syntax for this language.
I guess the only thing I want you to keep in mind when suggesting syntax and whatnot is to try to make it fun to write in. Something you'd like to make a program or two with. The language can be simple, complex, or moderate, it can be completely original or it can combine elements of other languages together. But please, this will not be an esoteric language
Syntax last updated: 4:24pm EST (GMT-5) on 19 Aug 2011. Change with block comments and methods, etc.!!
Spoiler For Current syntax:
* - Indicates a change + - Indicates an addition # - Indicates a removal Since last edit, that is. -- As in many languages, a semi-colon will mark the end-of-line. -- Strings will be like every other programming language; beginning and ending with a (double) quote. -- *Block comments will be [[ comment ]], single line comments will be "//comment" -- Modifiers are the same as any .NET language. These include "public," "private," "sealed," and "abstract". However, "public" will be "global," "private" will be "internal," "sealed" will be "closed," and "abstract" will be "open". -- Threads will be a built-in type for easier access. (yay) -- #Moved arrays and matrices so they have their own mini-topic -- Instead of using "." to access the methods of a variable, the colon (":") will be used. I.e. instead of "<var>.<method>;", it will be "<var>:<method>;" -- Accessing the current application/class will be "current" instead of "this" or "Me". -- Inheritance will be implemented. -- "parent" will be used instead of "base" (like in C# or <insert other language that uses "base">) or "super" (like Java). -- "break" (from C#, not sure on its equivalent in Java, etc.) will be "exit" -- "quit" will be a general command to exit the program, unless in an infinite loop . -- +Preprocessor directives will only be in the main file and will be denoted by '@'.
VARIABLES Will be defined by "<type> <name> [= <value>];" -Here is a list of current types (layout is "<type> : <declaration name> : <default value>") -string : str : "" -integer : int : 0 -boolean : bool : false -byte : byte : 00
CONDITIONALS Will be accessed by "if (<condition>) { <code> } elseif (<condition>) { <code> } else { <code> }" You will also have the ability to use switch/case statements that will be used in a similar fashion.
METHODS / FUNCTIONS Methods, since they don't return anything, are sub-procedures and therefore will be accessed by "<modifiers> sub <method name> ([<arguments>]) { <code> }" Functions will be similar, replacing "sub" with their return type. "<modifiers> <type> <function name> ([<arguments>]) { <code> return <type>; }"
LOOPS Will support 4 types of loops: -While "do { <code to be executed until condition is false> } while (<condition>);" -Until "do { <code to be executed until condition is true> } until (<condition>);" ---Both of the above loops can have the "test" (the "while" or "until" part) either before "do", or after the closing brackets like in the example. -For "for (<int>[ = beginning], <end>[, increment]) { <code> }" -For Each "foreach (<type> <var> in <collection [of type]>) { <code> }" Thanks to calcdude for the idea of testing before and after.
CLASSES Will be implemented in the same way that most languages (at least the ones I know) implement them. "<class name> <class var name> = new <class name>;"
ENUMS An enum, in case you don't know what it is, is basically a group of numbers. However, in Zenon, they can be a group of anything. (If that can't be done, then a new group type will be added called Group) -Declared: "<modifiers> enum <name> { <name> = <number>, <name2> = <number>, etc. }" -Accessed: "<enum> <var name> = <enum>:<enum child>;"
+ARRAYS/MATRICES As an example, here are declarations of a string array, matrix, and collections that have more that 2 dimensions: -Array: str# hello = new str#[0][1][2]; -Matrix: str# hello = new str#[[0][1][2],[3][4][5]]; -Multi: str# hello = new str#[[0][1][2],[3][4][5],[6][7][8]]; Or, for non-specific declarations, one can do -Array: str# inf = new str#[]; -Matrix: str# inf = new str#[,]; -Multi: str# inf = new str#[,,];
Yeah, I know about their TextEditor and AvalonEdit, but I'd prefer not to use any 3rd-party controls for the time being. This is something I've been meaning to get around doing for a long time, and I now have the perfect motivation.
I'm also not sure if I want the end product to be open-source or not, and from my understanding it would need to be open-source if I used TE or AE :\
I'm working on an IDE and the first thing I want to tackle/complete is the text editor. Right now I'm working on the syntax highlighting part of it. Strings highlight perfectly, and so do keywords. However, the part where it un-highlights keywords that have been partially deleted seems to not want to cooperate.
Here's my code, for anyone who thinks they can help, or just wants to take a peek at it (I comment a lot, so it should be fairly easy to understand)
//Initiate vars string[] lines = this.Lines; int pos = 0; int cpos = this.SelectionStart; int line = this.GetLineFromCharIndex(cpos);
//Let's see if there are even any keywords in the line. //If not, we'll exit bool cont = false; foreach (string kw in rsrvdWrds) if (lines[line].Contains(kw)) cont = true;
//If the current line doesn't contain any words, if (!cont) return; //Exit
//Get the exact beginning char index of the line for (int i = 0; i < line; i++) //+1 because of \n pos += lines[i].Length + 1;
//Now pos is the index of the first char on the current line //Reset line colors (THESE ARE THE FOUR LINES THAT *SHOULD* RESET THE LINE COLOR) this.SelectionStart = pos; //Go to beginning of line this.SelectionLength = lines[line].Length; //Select the line this.SelectionColor = Color.Black; //Turn it black this.SelectionLength = 0; //Deselect the line
//For each match of keyword in the current line foreach (Match kw in reservedWords.Matches(lines[line])) {
//Highlight any strings that might be in the line's string this.HighlightString(line);
//Resume current position this.SelectionLength = 0; this.SelectionStart = cpos; this.SelectionColor = Color.Black; Oh, by the way, this is an extended control. By that, I mean it's a control that inherits from the RichTextBox. That's why it says "this" instead of "rtbCode" or something like that.
Nowhere near as optimized as weregoose's, but I made a program for all of the original systems you stated found here. I'm sure the loops could be combined to do something like weregose's, but I' too lazy to do something like that on-calc at the moment.
First, umm... You might want to read the rules. I got yelled at for double posting outside of the rules one time, and you triple posted at the beginning >.>
Anyway, I like making userbars too I made all of mine except the bottom two and the TBEXE progress one.
EDIT: Just from a quick glance there's another double post by you. >.>