How to develope prolog parser for pl code? : I am new in prolog i have a code that i want to read from file then parse this is perl code here 


        var x;
        x <- (5 * 2);
       return (x + 1).
 now in prolog i want to tokenize this like this first 

     [’var’, ’x’, ’;’, ’x’,’<-’, ’(’, 5, ’*’, 2, ’)’, ’;’, ’return’, ’(’, ’x’, ’+’, 1, ’)’, ’.’]

the i want to implement predicate

     parse(+TokenList, -AST)

then again 

    evaluate(+AST, -Number)

using **SWIProlog** 

The parser should not allow the keywords of the language (e.g., the arithmetic operators, <-,
var, return) as variable identifiers