Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Lex & Yac

  1. Feb 24, 2009 #1

    am trying to modify the scanner.l file to also allow variables & function names to have a lower or uppoer case letter followed by zero or more lower or upper case letters or digits. I have test.vsl programming that i'm trying it against, but every time i compile the vsl file i.e

    ./vc < prog.vsl > prog.
    which looks like this

    // this is comment
    /* this is c style comment */

    FUNC main()

    VAR I

    I := 0


    i keep getting an error saying
    vc: syntax error near line 4
    vc: Bad function syntax near line 4

    In scanner.l i took away the default patter matching for variable i.e {lc_letter}({lc_letter}|{digit})*

    and replaced it with my own which is curretently:
    variable ({lc_letter}|{uc_letter})
    but it still does not work. Can somebody help please.
    Last edited: Feb 24, 2009
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?