Read Me
# Bhasha is a joint work of Aditya Huddedar, Ankit Awasthi, Ankit Sharma,
# Bharat Daga, and Shantanu Saraswat. The people mentioned above hold all
# copyrights to Bhasha. Any modified aor copied version of this software
# must contain this notice.
#
# This file is part of Bhasha.
#
# Bhasha is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bhasha is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bhasha. If not, see <http://www.gnu.org/licenses/>.
SOURCE LANGUAGE: ASP
TARGET LANGUAGE: PHP
IMPLEMENTATION LANGUAGE: Python
To run the code use command:
Usage: python bhasha.py <inputfilename.asp> [<outputfilename.php>]
To compile all the ASP files in the testcases/ subdirectory use:
Command: ./compileall
To delete all the generated PHP files in the testcases/ subdirectory use:
Command: ./cleanall
Lexfile:
vbslex_final.py
Parsefile:
vbsparse3.py
BASIC FEATURES IMPLEMENTED
Basic types : Boolean, Integer, Double, String, Byte, Long, Single, Date, Currency
Complex types: Objectst
Operators:(+,-,*,/,\,MOD,^,&, <, <=, =>, >, >=, =>, =, <>, AND, OR, NOT XOR)
Arithmetic: 'PLUS', 'MINUS', 'TIMES', 'DIVIDE','INTDIV', 'MOD', 'EXP', 'CONCAT'
Logical: 'AND', 'OR', 'NOT', 'XOR', 'IMP'
Comparison: 'LT', 'LE', 'EL', 'GT', 'GE', 'EG', 'EQ', 'NE'
String: 'INSTR','INSTRREV','REPLACE','UCASE','LCASE','LEN','TRIM','LEFT','RIGHT','MID','SPLIT','CHR','ASC'
Expressions:
ASP permits a lot of implicit type conversions. We have taken care of all the type checking in expressions and allowed only those implicit type conversions which are permitted by ASP.
Constants: Boolean, Numeric, String
Comments: Single line
Keywords: AND
BYREF
BYVAL
CALL
CASE
CLASS
CONST
DIM
DO
EACH
ELSE
ELSEIF
EMPTY
END
EQV
EXIT
FALSE
FOR
FUNCTION
GET
GOTO
IF
IMP
IN
IS
LET
LOOP
MOD
NEW
NEXT
NOT
NOTHING
NULL
ON
OPTION
OR
PRESERVE
PRIVATE
PUBLIC
REDIM
RESUME
SELECT
SET
SUB
THEN
TO
TRUE
UNTIL
WEND
WHILE
WITH
XOR
DEFAULT
ERASE
ERROR
EXPLICIT
PROPERTY
STEP + unused Reserved words for the consistency
Language features:
Control flow:
1. If statement
2. While loop
3. Until loop
4. For loop
5. Select statement
Type checking:
1. Type infering from the assignment.
2. Checking the consistency of type of a variable throughout the programme.
3. We propagate the error and continue parsing the code with appropriate error messages with line numbers.
Functions:
1. We check arity of the function.
2. We maintain a proctable to store the function and its arity.
3. We also infer the type of a function.
Arrays:
1. We handle single and multidimensional arrays.
2. As the syntax for accessing array-elements and function call have similar syntax in ASP, we had to devise ad-hoc methods for handling
arrays.
Classes:
1. We check the accesstype of the class and convert it to equivalent code in PHP
2. We also have implemented properties of the classes in ASP.
Builtins(Some of them)-
We have implemented some of the builtins of ASP suitable for PHP. We are able to parse simple ASP forms using Request and Response builtins.There are few test codes of ASP forms attched.
bhasha.py:
We separate the underlying VBscript code using a filter code bhasha.py. The VBscript is then compiled into corresponding PHP code and again wrapped with the original HTML code to give the final output.