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

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Help me:Programing languague


    Imagine you have a small Robot that you need a way to communicate with, you decide to make a language for such robot, the language would instruct the Robot to move forward and backward by specifing number of steps (units), also you can instruct the Robot to turn left or right by specifing a number that represents the degrees. The following lists are what you need to do ?

    1) a winword document that has the BNF language for such language.

    2) some text files that represents some programs written in such language.

    3) a C source code that analyze the program ( lexical analyzer and syntax analyzer) for such language
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Cool! Sounds like a fun assignment! Show us what you've done so far!
  4. #3
  5. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,109
    Rep Power
    1802
    You will presumably have attended some classes/lectures already and been provided appropriate course materials and text? That being the case - carry on! We have not had the benefit of those classes or materials.

    The question is not entirely within the domain of this forum. When you get to part three and have a specific problem, let us know and someone might be able to help. However by the time you have done (1) and (2), (3) should be fairly straightforward.

    I think the requirement can be met by just two commands, with each command takes a single signed integer value. It is probably far simpler that you are perhaps thinking.

    Since the specification states that the arguments to "move" and "turn" (or whatever you choose to call your commands) are numbers rather than expressions the design and implementation are rather simple. An expression evaluator would complicate things somewhat, but it seems not to be required here.
    Last edited by clifford; November 4th, 2012 at 01:23 PM.
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    Mmmm, small robot and "move commands".
    Sounds like logo
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  8. #5
  9. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally Posted by salem
    Mmmm, small robot and "move commands".
    Sounds like logo
    Or Karel, a book that taught programming through the programming of a robot. Though I think the original was based on Pascal, but then in Karel++ they switched to C++. I think it was named after Karel Čapek, the playwright of the classic 1921 Czech sci-fi play, Rossum's Universal Robots, which spawned the term "robot" ("robot-" is the Slavic root for "work", as in the Russian verb "robotat' ", "to work" ).
  10. #6
  11. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Norcross, GA (again)
    Posts
    1,805
    Rep Power
    1570
    I agree Clifford; this is a classic example of a 'turtle'. In its original form, the turtle was a physical device that rolled along the floor; by the 1970s, a 'virtual' turtle was commonly used in Logo and it's relatives. Even today, some languages (such as Python) include a ''turtle graphics' package.

    For both implementation and use techniques, the textbook Turtle Geometry is an under-appreciated classic. There's a good chance you can find a copy in some dusty corner of your university library; if not, a copy of it is only US$45 ($65 if you get Mindstorms as well, another classic on the subject, which covers the use of turtle graphics in teaching for young children).

    As for writing a compiler or interpreter, you may want to look at this thread for some advice and useful links (though some of the links are now stale, sadly).
    Last edited by Schol-R-LEA; November 4th, 2012 at 02:24 PM.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short Understanding the C/C++ Preprocessor
    Taming Python A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    thank you


    i have exams and i don't have time to do these home work......
    help me please...

    Comments on this post

    • ptr2void disagrees : What dwise1_aol said below.
  14. #8
  15. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    OK, I'll help you. Here it is: Find a different major.

    1. We help people with their homework. Doing it for them would not be helping them.

    2. When you take somebody else's work and turn it in as your own, you are committing plagiarism. Committing plagiarism gets you expelled from your school, ending your academic career. Aiding and abetting your commission of plagiarism would not be helping you.

    Do your work and get back to us with questions about problems that you encounter in doing your own work.

    Comments on this post

    • jakotheshadows agrees : Damn straight. I have exams too and I somehow through lack of sleep and hygiene manage to get my work done anyways. Maybe he should go for a business degree. I hear anyone can manage one of those.
  16. #9
  17. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    149
    Rep Power
    36
    Originally Posted by waleedsafi
    3) a C source code that analyze the program ( lexical analyzer and syntax analyzer) for such language
    You might try Flex and Bison (google is your friend) to help you generate the C source for your scanner and parser. If you understand CFGs and the like then you should be able to pick up on how to use Bison fairly quickly.
  18. #10
  19. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,109
    Rep Power
    1802
    All this talk of Logo and Turtle Graphics etc. is all valid but probably over complicating the issue. This is a very simple subset of a turtle like language, and Logo is so much more than just turtle graphics. The language in question is not a Turing complete language and Flex and Bison etc. are probably unnecessary for this task.

IMN logo majestic logo threadwatch logo seochat tools logo