⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notes

📁 把pascal程序转成C语言程序 把pascal程序转成C语言程序
💻
📖 第 1 页 / 共 3 页
字号:
   Support the "BigSetConst" option by creating constant arrays just as the   Pascal compiler does.-----------------------------------------------------------------------------   The 2^(N+1) - 2^M method for generating [M..N] is not safe if N is 31.   If the small-sets we are dealing with encompass the value 31 (== setbits-1)   then we must use the bitwise construction instead.  (Currently, the   translator just issues a note.)   (If N is 31, 2^32 will most likely evaluate to 0 on most machines, which   is the correct value.  So this is only a minor problem.)-----------------------------------------------------------------------------   Big-set constants right now are always folded.  Provide a mechanism   for defined set constants, say by having a #define with an argument   which is the name of the temporary variable to use for the set.-----------------------------------------------------------------------------   Should we convert NA_LONGWORD-type variants into C casts?-----------------------------------------------------------------------------   Are there implementations of strcpy that do not return their first   argument?  If so, should have an option that says so.-----------------------------------------------------------------------------   Handle absolute-addressed variables better.  For  var a[12345]:integer,   create an initialized int *.  For  var a['foo']:integer, create an int *   which is initialized to NULL and accessed by a macro which locates the   symbol the first time the variable is used.-----------------------------------------------------------------------------   Handle the idiom, "reset(f, name); open(f);"-----------------------------------------------------------------------------   Should have an option that lowercases all file names used in "reset",   "fixfname", etc.  This should be on by default.-----------------------------------------------------------------------------   Add more complete support for conformant arrays.  Specifically, support   non-GNU compilers by converting variable-sized array declarations into   pointer declarations with calls to alloca or malloc/free (what if the   function uses free and contains return statements)?  Also convert   variable-array references into explicit index arithmetic.-----------------------------------------------------------------------------   Have a mode in which the body of a TRY-RECOVER is moved out into   a sub-procedure all its own, communicating with the parent through   varstructs as usual, so that the ANSI C warning about what longjmp   can do to the local variables is avoided.  Alternatively, have an   option in which all necessary locals are declared volatile when   setjmps are present.-----------------------------------------------------------------------------   If a sub-procedure refers to a parent's variable with the VAX Pascal   [STATIC] attribute, that variable is declared "static" inside the   varstruct!  Need to convert it into a varref to a static variable in   the parent.-----------------------------------------------------------------------------   When comparing records and arrays a la UCSD Pascal, should expand   into an "&&" expression comparing each field individually.  (What about   variants?  Maybe just compare the first variant, or the tagged   variant.)  Probably best to write a struct-comparison function the   first time a given type of struct is compared; that way, the function   can include a complete if tree or switch statement in the case of   tagged unions.-----------------------------------------------------------------------------   In the checkvarchanged code, take aliasing of VAR parameters into account.   For example, in "procedure p(s1 : string; var s2 : string)" p2c now avoids   copying s1 if s1 is not changed within p, but probably should also require   that s2 not change, or at least that s1 have been read and used before s2   is changed.-----------------------------------------------------------------------------   Provide an option that tells the code generator to provide helpful   comments of its own when generated code may be obscure.=============================================================================   Compact the various data structures.  In particular, typical runs   show the majority of memory is used by Meanings and Symbols for   global and imported objects.-----------------------------------------------------------------------------   The program wastes memory.  Find ways to reduce memory usage, and to   avoid leaving dead records on the heap.  (Garbage collection?  Yuck!)   (Maybe GC between each function declaration would be okay.)-----------------------------------------------------------------------------   Assign better names to temporaries.  Also, could avoid making redundant   temporaries by generating a unique temporary every time one is needed,   then crunching them down at the end just before the declarations are   written out.  Each temporary would maintain a list of all the other   temporaries (of the same type) with which it would conflict.  (This   would avoid the current method's waste when several temps are created,   then most are cancelled.)  Also, note that char STR1[10], STR2[20] can   be considered type-compatible and merged into STR[20].-----------------------------------------------------------------------------   Don't generate _STR_xxx structure names if they aren't forward-referenced.-----------------------------------------------------------------------------   Can optimize, e.g., "strpos(a,b) = 0" to a call to strstr() or strchr(),   even though these ANSI functions are not Pascal-like enough to use in    the general case.-----------------------------------------------------------------------------   Complete the handling of "usecommas=0" mode.-----------------------------------------------------------------------------   Optimize "s := strltrim(s)", "s := strrtrim(s)", and both together.-----------------------------------------------------------------------------   Convert "(ch < 'a') or (ch > 'z')" to "!islower(ch)", and so on.   Also do "!islower(ch) && !isupper(ch)" => "!isalpha(ch)", etc.-----------------------------------------------------------------------------   Find other cases in which to call mixassignments().-----------------------------------------------------------------------------   The sequence:   sprintf(buf + strlen(buf), "...", ...);                   sprintf(buf + strlen(buf), "...", ...);   could be changed to a single sprintf.   Also, "sprintf(temp, "...%s", ..., buf); strcpy(buf, temp); (above);"   could be crunched down.  (This comes from strinsert, then strappend.)-----------------------------------------------------------------------------   If there is only one assignment to a structured function's return   variable, and that assignment is at the very end and assigns a local   variable to the return variable, then merge the variables.   (Example: name_list in netcmp's datastruct module.  RET_name_list   should be renamed to namestr.)-----------------------------------------------------------------------------   Have an option that causes if-then-else's to be replaced by ? :'s in   certain cases.  If the branches of the if are either both returns or   both assignments to the same variable, which has no side effects, and   if the whole conditional will be simple enough to fit on one line when   printed, then the ? : transformation is okay.-----------------------------------------------------------------------------   Have an option that finds cases of multiple assignment.  For example:      a := x; b := x;   =>  a = b = x;      a := x; b := a;   =>  a = b = x;   (provided the objects in question have the same type).-----------------------------------------------------------------------------   Need an option that causes $if$'s to change to #if's, instead of being   evaluated at translation-time.  (This is *really hard* in general;   do it for some common cases, such as entire statements being commented   out, or fields being commented out of records.)-----------------------------------------------------------------------------   Have an option that prevents generation and inclusion of .h files for   modules; instead, each module would contain extern declarations for   the things it imports.  (Only declare names that are actually used---   this means the declarations will have to be emitted on a procedure-by-   procedure basis.)-----------------------------------------------------------------------------   Extend the ExpandIncludes option to compile include files as separate   stand-alone C modules.  The hard part is warning when the new module   uses a procedure which was declared static in an earlier C module.   Remember to re-emit all the proper #include's at the beginning.   Anything else?-----------------------------------------------------------------------------   Consider an option where the variables in a varStruct are made into   globals instead, or into parameters if there are few of them.-----------------------------------------------------------------------------   Get flow analysis to eliminate redundant nil pointer checks.   Also, there's still room for improvement in the handling of   file names in StructFiles mode.-----------------------------------------------------------------------------   Need a method for simple pattern matching predicates in FuncMacros.   For example, allow special translations of functions where a given   argument is a known constant, or known to be positive, or two   arguments are the same, etc.-----------------------------------------------------------------------------   Have some way to provide run-time templates for fixblock/fixexpr-like   applications.  The user enters two C expressions A and B, possibly including   Prolog-like logical variables.  If fixexpr sees an expression matching A,   it rewrites it into the form of B.-----------------------------------------------------------------------------   Have an option to cause selected Pascal procedures or functions to be   expanded in-line.  Do this either by generating the keyword "inline",   or by doing the expansion in the translator.-----------------------------------------------------------------------------   Technically speaking, strcmp shouldn't be used to compute < and > for   strings on a machine with signed chars.  Should we care?-----------------------------------------------------------------------------   Have an option for creating a "display" of LINK pointers local to a   function.  Should only create such pointers for static levels which are   referred to in the function body.-----------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -