|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#17
|
|||
|
|||
|
hmmmmm...
dragon book... Does that tell you about coding on vb2008? Anyway i'll start reading. If not, could anyone give me a website to code a compilier on vb2008? ![]() |
|
#18
|
||||
|
||||
|
I'll comment your syntax in a second post...
Quote:
I see. Just as a friendly reminder. The time required to create your own programming language capable of creating a 3d game FAAAAR outweighs the time required to learn the tools that are already there. Under NO circumstances will creating your own programming language reduce the effort required to write your own game. If you want to do this as an exercise or just for fun, I'll help you but I'm not going to support an illusion that will leave you disappointed and with a lot of wasted time.
__________________
- Hugh of Borg The first thing young borg are taught: Keep away from Microsoft software! |
|
#19
|
||||
|
||||
|
D**n! I just lost all that I typed... So this is going to be a little shorter.
Lot's of it looks good. You're going for a BASIC-like syntax I see. There are however a few points that require some comment: I like the rounding operator but I suggest you redefine it as the normal rounding instead of rounding-up (ceiling) and that you add additional operators for both the ceiling (up) and floor (down) rounding. My suggestions would be: ~ round to nearest integer ~< round down ~> round up Language bloat. You are putting a lot of functionality into the syntax itself. Like playing sound, accessing files, and placing stuff into a virtual world. This is a very problematic approach that provides no real benefit. Most languages I know follow a different strategy. Their syntax only contains what is needed to write code. Functionality like the above is then provided through a standard API. I strongly suggest you follow that model as it makes the language easier to learn/handle and the compiler much easier to write. Also consider that by incorporating all this functionality into the syntax itself you'll end up with a new PL every time you need to fix an error in your Sound Engine, Game Engine etc. I am also unsure as to how your variable declarations are supposed to work. Can you provide me with an example where you declare a variable 'foo' and set it to the numeric value four and then declare a variable 'bar' and set it to the string value 'eight'? There are still a lot of things missing but that is ok since I only asked for a sample... If you want to proceed then there are a number of things to define:
|
|
#20
|
|||
|
|||
|
Quote:
I fully agree with this statement. |
|
#21
|
|||
|
|||
|
Quote:
To define such as a word like "foo" as you said, It is right here: Code:
Variable as [foo] foo = replace_keyword_digit_4 Variable as [bar] bar = replace_keyword_digit_8 Or.. Code:
Variable as [foo]=4 Instead of having to write in declare, it is just easier to put in something like Variable as [name you want] The replace function replaces the keyword digit for the project you are working on (on the scripting program) This is how it works if you have numeric values like: Code:
1, 2, 3, 4, 5, 6, 7, 8 It's now changed to: Code:
1, 2, 3, foo, 5, 6, 7, bar Is that the example you wanted? If it's not then just tell me and I will add a different example. Did you just want: 1. Replace the 4 digit with foo, replace 8 digit with bar OR 2. foo = 4, bar = 8 or anything else? Sorry if that is the example you didn't want... ![]() |
|
#22
|
|||
|
|||
|
Quote:
That is more better and suitable code for rounding. ![]() |
|
#23
|
||||
|
||||
|
Quote:
This is what I'm looking for. Code:
Variable as [foo] foo = 4 Variable as [bar] bar = "eight, acht, huit, otto, ocho" Which brings us back to the data types. What kind of datatypes to you have in your language? And how do you determine the type of a variable. If you use the variable foo somewhere in your code how does the compiler know what type it is? Also the 'as' keyword makes no sense imho. VB uses the syntax: Dim <Variablename> As <Type>. Unless you are going to add a typedeclaration like "Variable <Variablename> as <Type>" then I suggest you leave the 'as' away. It serves no purpose and isn't appropriate from an english language's point of view. |
|
#24
|
||||
|
||||
|
Quote:
Ahhh... That is what you are looking for... ![]() Quote:
oh... That was string value eight, i thought it was numeric. Sorry... Do you want another example of a variable declare like something different so you can understand a bit more? Like string, integer, boolean, numeric, etc? ![]() |
|
#25
|
||||
|
||||
|
Quote:
Which brings us back to the data types. What kind of datatypes to you have in your language? And how do you determine the type of a variable. If you use the variable foo somewhere in your code how does the compiler know what type it is? |
|
#26
|
|||
|
|||
|
Quote:
Yes. Because when you declare a variable, such as foo it knows what type it is, let me show you below: <type> as [foo] Variable is the type you choose to identify foo. Like if you use "Foo" as a number you use Variable. If you want it a message, you use string, or if you use it as a counter you use Integer. <type> is the type chosen to declare the word. |
|
#27
|
||||
|
||||
|
Quote:
I see. So things would look like this: Code:
Integer as [foo] foo = 4 String as [bar] bar = "eight, Acht, huit, otto, ocho" Boolean as [hasCheezburger] = TRUE Good, things are going forward. There are a few more questions and then we can start with formally defining the language. First question: Arrays... How are they declared? How are they initialized? And how can you access the individual items of the array? Second question: What are the operators for: Greater than? Less than? Greater or equal than? Less or equal than? Equal to? Not Equal? Boolean And? Boolean Or? Boolean Not? Boolean Xor? |
|
#28
|
||||||
|
||||||
|
Quote:
Exactly correct! That is how the types of variables are declared! OK, i will answer your questions:: Quote:
OK. Here is one example to declare an array of days, months and years: This is a jagged array variable. Code:
Byte as [YearMonthDay] ()()() This is a multidimensional array. Code:
Short as [atmospherePressures] (,,,) This is a one-dimensional array. Code:
Double as [ArrayTypes] () That is an example of how do declare arrays Creating arrays Integer as [scores] () scores = New Integer() {} So you declare arrays like <datatype> as [name] () () () = The array options like 1, 2, 3, etc... ()I hope you understand() Quote:
Examples are below::: (Equal, less, greater than...) Code:
Greater than < (or is it the other way around?) Less than > Greater or equal than < or = than Less or equal than > or = than Equal to = Not Equal Not = (Try and give me better examples please... :D ) Some examples: Greater than, less than, equal to, not equal Variable as [Sample] Sample = 1 Variable as [Sample1a] Sample = 1 Variable as [Sample2] Sample = 2 Variable as [Sample3] Sample = 32767 Sample is equal to Sample1 Sample 2 < Sample \\This means sample 2 is greater than sample 1. Sample > Sample 2 \\This means Sample is less then sample 2. Get the less, greater thans, equal to. Sample2 is not equal to Sample3 \\Sample 2 is not equal because sample2 = 2 and sample3 = 32767. I hope you understand?? Boolean: Code:
Boolean And Boolean Or Boolean Not Boolean Xor Examples: Boolean as [Sample] If Sample=true OR Sample=false Then ..... End If The OR is the use of Boolean OR If Sample=true Then Sample=false Or... If Sample=true Then Not Sample=true This means if you click this button set to true, it is now set to false and if you click on it being set to false it will be set to true. Xor example: Boolean as [Sample] = False Boolean as [Expression1] = True Boolean as [Expression2] = True Sample = Expression1 Xor Expression2 Xor performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. Simple... Quote:
I'll explain below: Greater than Less than Greater or equal than Less or equal than Equal to Not Equal The following are the comparison operators defined: < operator <= operator > operator >= operator = operator <> operator Boolean And - Generates a string concatenation of two expressions. Boolean Or - Performs a logical disjunction on two Boolean expressions, or a bitwise disjunction on two numeric expressions. Boolean Not - Performs logical negation on a Boolean expression, or bitwise negation on a numeric expression. Boolean Xor - Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. Yep, that is how arrays are declared, and booleans... |
|
#29
|
||||
|
||||
|
Code:
//jagged 3D array
Byte as [YearMonthDay] ()()()
//rectagular 3D array
Short as [atmospherePressures] (,,,)
//This is a one-dimensional array.
Double as [ArrayTypes] ()
//Creating arrays
Integer as [scores] ()
scores = New Integer() {}
Alright. Not everything I asked but I'll try to extrapolate: Code:
//To initialize a blank array of length 4
scores = New Integer(4)
//To initialize an array with the values "one", "two" and "three"
foo = New String() {"one", "two", "three"}
//To set the second value of an array
foo(1) = "dos cervezas"
I've collected all the variations you posted... Btw > means greater than... Code:
Greater than > Less than < Greater or equal than > or = >= Less or equal than < or = <= Equal to = = is equal to Not Equal to Not = <> is not equal to Boolean And And Boolean Or OR Boolean Not Not Boolean Xor Xor 1. You should only have one operator for each operation... I've highlighted the ones I think would be best 2. Both the assignment operator and the operator to compare for equality are the same. While possible to handle it can make the code ambiguous and it will prevent you from having assignments inside of expressions. Example: |
|
#30
|
|||||
|
|||||
|
Quote:
Quote:
Yes, that is what I had in mind. It is exactly what the code is like. Quote:
Got any more questions? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Game Development > Create my own programming language |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|