#16
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    16
    Rep Power
    0
    +1 for dragon book
  2. #17
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0

    Wink


    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?

  4. #18
  5. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    I'll comment your syntax in a second post...
    Originally Posted by Buzzy661
    So I could use my own programming language to create my Game Engine and then I could make my 2d and 3d games.

    Other languages like vbC++ or python ok but I decide to make my own programming language so I could understand it easier for my scripting.
    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!
  6. #19
  7. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    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:
    • Define the primitive types you have. ie. String, Boolean, Integer, etc.
    • Define if variables are strongly (fixed type) typed or loosely typed aka a variable can be interpreted in as Array, String, Integer (difficult to program).
    • Define how variables are declared and initialized?
    • Define how arrays are declared and initialized? How about multidimensional arrays?
    • Do you support jagged arrays or only rectangular arrays?
    • How are literal strings and literal numeric values defined? (Do you want to allow for more than just decimal literals?)
    • What is a legal identifier for a variable, class or method?
    • What are the operators and what priority sequence do they have?
    • Define the program structures (if-then-elseif-else, while-loop, do-while-loop, for-loop, switch-case) you want to have and how they should look.
    - Hugh of Borg

    The first thing young borg are taught: Keep away from Microsoft software!
  8. #20
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    21
    Rep Power
    0
    Originally Posted by Hugh of Borg
    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.
    I fully agree with this statement.
  10. #21
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    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'?


    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...
  12. #22
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    ~ round to nearest integer
    ~< round down
    ~> round up
    That is more better and suitable code for rounding.
  14. #23
  15. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    Originally Posted by Buzzy661
    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
    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.
    - Hugh of Borg

    The first thing young borg are taught: Keep away from Microsoft software!
  16. #24
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    This is what I'm looking for.

    Code:
    Variable as [foo]
    foo = 4
    
    Variable as [bar]
    bar = "eight, acht, huit, otto, ocho"
    Ahhh...

    That is what you are looking for...

    variable 'bar' and set it to the string value 'eight'?
    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?
  18. #25
  19. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    Originally Posted by Buzzy661
    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?
    No that's all right.

    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?
    - Hugh of Borg

    The first thing young borg are taught: Keep away from Microsoft software!
  20. #26
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    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?
    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.
  22. #27
  23. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    Originally Posted by Buzzy661
    <type> is the type chosen to declare the word.
    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?
    - Hugh of Borg

    The first thing young borg are taught: Keep away from Microsoft software!
  24. #28
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    Integer as [foo]
    foo = 4

    String as [bar]
    bar = "eight, Acht, huit, otto, ocho"

    Boolean as [hasCheezburger] = TRUE
    Exactly correct! That is how the types of variables are declared!

    OK, i will answer your questions::

    First question: Arrays... How are they declared? How are they initialized? And how can you access the individual items of the array?
    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()



    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?
    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...
    Second question: What are the operators for:
    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...
  26. #29
  27. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    1,152
    Rep Power
    1902
    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"
    Is this what you had in mind?

    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:
    java Code:
    int c;
    while ((c = stream.read()) != -1)
    {
      // yadda yadda
    }
    - Hugh of Borg

    The first thing young borg are taught: Keep away from Microsoft software!
  28. #30
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    43
    Rep Power
    0
    //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"
    Is this what you had in mind?
    Yes, that is what I had in mind. It is exactly what the code is like.

    Good, things are going forward. There are a few more questions and then we can start with formally defining the language.
    Got any more questions?

IMN logo majestic logo threadwatch logo seochat tools logo