ASP to PHP Schema Option_Explicit. Version 44. ============================================== Copyright (C) 2003 Pharmease, Inc. Author: Konstantin Kirillov. CONCEPT ======= The source text syntax which this schema recognizes is a superset of (VISUAL) BASIC (SCRIPT) LANGAUGE. The word "recognizes" in above sentence is a synonim to words "converts", "passes", "defines". The word "superset" means that the set of texts which schema considers having a valid syntax is wider than defined for BASIC LANGUAGE; threfore, schema is not a narrow syntax-checker, but only a converter of a texts which should be already valid. Nethertheless, comments "extended syntax" put in schema in some cases where schema passes "extended syntax". Schema assumes that ------------------- - main or procedure text is built with expressions, standard-statements, and control-statements; expression state - denoted in schema as "e" waiting of expression state - we waiting of statement state - ws - expressions can be: sin(x)(f) + -5 abs/4 "hello"*3 ----"hello" ("TRANSITION we ---> we") "string".(3) . . -."hello" ("TRANSITION we ---> we") "hello"..print.6 ("ARITHMETICAL PART") - when completed, standard-statement nest is: e = e 'assignment e 'procedure-call-statement - control-statements use standard-statements and expression as building bricks, for example: if "hello" then x=4 else if true then time : sin = 6 else r "hell0" and true - are expressions; "x=4", "time", "sin=6", "r" are standard-statements; Term (name) streams ------------------- - tokenizer recognized three types of terms: identificator event - denoted in schema as .id number - .n string - .str - .n and .str events immediately recognized as expressions. - .id recongition is more complex: for declared variables, .id is immediately raises state of expression e; for non-declared, schema raises state "f" which can belong to function-call-statement, returning value from function or property, assingning a function name on the right part of an assignment; finally, state "f transforms to some form of state e"; CORE-TERM sections make a main job to start and direct name-streams recognition: SPLIT .id STREAMS - .id is split to .idv and idf events; PRINTING TERM'S NAME - only at this point name is being output to result MAIN SECTION WHERE FUNCTION NAME TRANSFORMS TO FUNCTION OR EXPRESSION TRANSFORM FUNCTION NAME TO FUNCTION OR EXPRESSION Sections which intercept core process flow are: wrappping.txt DIM-STATEMENT NAME RECOGNITION AT FUNCTION HEADER AND FOR CONSTANT This sections are located above CORE-TERM sections. Period plays two roles in BASIC: 1. decimal delimiter which handled correclty by schema; 2. part of object notations; schema assumes that wrapping an object is responsibility of programmer; HOW SCHEMA WORKS ================ This schema runs conversion two times. The first round accomulates declarations and is not saved. The second round is final. For round details, please look in section INITIALIZATIONS. Each function or subroutine parsed two times. First-time parsing is necessary to separate local and global variables. File main.txt is a schema. Files which are part of schema included in main.txt using action |include. DETAILS ======= * To disable output to console, make this directive "false": ..output_text_to_console.f * If source file conversion is crashed due syntax exceptions in source file, this does not stop other files from processing. Schema-variables used: ====================== variables - used as list gloVars - used as list constants - used as list d "dummy", used to redirect to dummy stream to skip output. a,b,c used to build a source-text statement. Therefore, programmer must avoid to use them for expressions to avoid to be overwritten in recursion. However, they can be used in different statement again. a,b used for Response.AddHeader and Response.Redirect a,b,c used in for-statement block: a keeps cycle variable name, b - restricting expression, c - step expression. x,y - occasionally used variables dd - used for dim; f - for function name; t - used for second(date), ... This use done safely, before recursion can start. fb - used to redirect output of function body from output. header - used to store string "function <function name>" global - used to maniputlate with list of global variables when parsing function. number - used when parsing number; if risky method used, risky changes reported to console at the end of project; variables used to accoumulate this reports are warn_asp, warn_str.