Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Syntax Analyzer for Your PL  (Read 405 times)

0 Members and 1 Guest are viewing this topic.

ozgunlu

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    Syntax Analyzer for Your PL
    « on: March 25, 2012, 11:06:48 AM »
    - all programs must start with “begin” and end with “end”
    - all commands must be ended by “;”
    - all variables must be declared just after “begin” in the following format;
    int: i num;
    float: fl;
    - three types exist; “int”, “float”, “char”
    - variables names may be any alphanumeric string, but they must start with a letter
    - statements between “begin” and “end” can be either a variable declaration or an assignment
    - an assignment includes four type of operators; +,-,*,/.
    - the number of variables or constants in an expression is unlimited
    - the presedence of operators given as..............
    - ........
    - .etc

     Your PL should include a  well-defined regular grammar for variable names, rules for
    variable declarations including their type, at least 4 arithmetic and 3 logical operators with
    their precedence and associativity rules with and without parenthesis, indefinite number of
    assignments with expressions having unlimited number of operands.


    How can i do? I have to use C language and ANTLR

    Rob Pomeroy



      Prodigy
    • Systems Architect
    • Thanked: 123
      • Me
    • Experience: Expert
    • OS: Other
    Re: Syntax Analyzer for Your PL
    « Reply #1 on: March 26, 2012, 06:41:07 AM »
    We don't do homework here.  How will you learn if people do the work for you?
    Only able to visit the forums sporadically, sorry.

    Author of the fantasy thriller, Insensate - available for all ebook readers and iDevices. Find out more >here<. Only 99p/99˘!

    Geek-9pm



      Genius
    • Geek After Dark
    • Thanked: 462
      • Geek 9pm blog
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows XP
    Re: Syntax Analyzer for Your PL
    « Reply #2 on: March 26, 2012, 02:46:00 PM »
    All the statements are either false or not universally true.
    Entire programs can be written without a single semi colon.
    Entire programs can be written with using C or any part of it.
    Operators are not always needed. Just nice to have.

    The is a very real limit to the number of variable. The number of variables must be less that the numb er of atomic particles in the universe. In practice, even much bless that that.

    Ect.? No, ect.  ? No, etc can not be used to define a language structure.