Inno Pascal
Copyright (C) 2000 Jordan Russell. All rights reserved.
Download version 0.1.5 (date 2000-10-12, approx. 390 KB)
Usage: After unzipping, start IP.exe. Then open one of the files in the Examples subdirectory for a compilable example.
Project Status:
Discontinued. It was fun but I don't have time to work on it anymore.
What is it?
Inno Pascal is a simple Pascal compiler for Win32. It produces compact, native-code x86 executables without requiring any external assemblers or linkers. It was written entirely from scratch; it is not based on any other existing compilers. Full source code is included under the GPL license.
At the present time, it's in an "experimental" phase. There aren't that many things it can do.
Revision History
0.1.5
- Renamed program from 'IPascal' to 'IP'. Also renamed Linker unit to LinkerPE. Lots of other code restructuring.
- Improved handling of expressions. They are now first parsed into an internal structure, with the code generated later. (There's still more work to be done, though.)
- Got rid of "expr()". Now you can use expressions directly.
- Full expressions can now be used in constants and in procedure parameters.
- Added compile-time constant folding. 1 + 1 is translated to 2 at compile time.
- Now supports subrange types, i.e. type MyType = 1..5. Currently subrange types are always 4 bytes in size regardless of the range. Also, subranges can currently only be used in a type declaration; you can't declare a variable like var A: 1..5.
- Somewhat more optimized code is now generated for all of the operators in expressions.
- New operator: mod.
0.1.4
- Run-time integer expression support. Expressions may currently only be used in variable assignments, and currently must be surrounded by "expr()", for example: "A := expr(1 + 2 * 3);". Four operators are currently supported: + - * div; parentheses may also be used. Functions may be called inside expressions. The code generated by expressions is far from optimal at this time; every term is pushed and popped from the stack.
(Note: Some of the code for this feature was inspired by the "Down to the Metal" article in the Oct. 1997 issue of Delphi Informant, which in turn was inspired by the Dragon Book.)
- New built-in SizeOf function added. Currently you have to surround it by "expr()" even if it isn't part of an expression. Example: StartupInfo.cb := expr(SizeOf(TStartupInfo));
0.1.3
- Now supports include files via {$I filename}.
- Debugger now sets current directory to the directory containing the EXE.
- Other small improvements & fixes.
0.1.2
- Compiler now shows hints and warnings about unused and uninitialized variables. One known limitation: Hints always show as having a cursor position of [1,1]. To be fixed later.
- Syntax highlighter now uses highlighter settings from Delphi, if installed.
- Linker now delays and makes a second attempt to write the EXE file if the first attempt fails. This should fix the intermittent "I/O Error 32" errors which might have occured if you did Stop and Build (or a similar operation) in quick succession.
- Source code reorganization: Moved debugger into a new unit, Debugger.pas. Also moved linker into a new unit, Linker.pas.
- Editor and compiler fixes.
0.1.1
- Now allows type declarations like "MyInteger = type Integer;". This kind of declaration creates a clone of an existing type instead of an alias. Referring to the preceding example, you could not pass a MyInteger type to a 'var' parameter of type Integer. But without "type" in the declaration, you could.
- Flaw in "Run to Cursor" command (noted in 0.0.7 history) should be fixed.
- Event log now shows names of DLL being loaded, thanks to Michael Hieke.
- Now clears dots in editor's gutter when the source is modified while not debugging.
- Now shows time spent compiling.
- Fixed and optimized CalcHash in Compiler.pas with help from Michael Hieke.
- Integer constants are now properly range-checked.
- More strict type checking on 'var' parameters.
0.1.0
- New example: RunProgram.pas, which demonstrates the new "record" support. (Also note that all examples have been moved into a new Examples subdirectory.)
- Record fields can now be assigned to. It even supports nested records (e.g. "A.B.C := 1").
- "packed" records now supported. Without "packed", record fields are word/dword/qword-aligned exactly like Delphi 5 (..at least they should be).
- Fixes and improvements to the "Source modified, do you want to restart" message.
- Major revamping of compiler.pas. Instead of having one huge procedure with countless nested procedures that do the compiling, each of the nested procedures have been changed to be procedures of the class.
0.0.9
- Strings constants can now include control characters (e.g. #123) and the "+" operator (thanks in part to Michael Hieke).
- Now supports "record"s in "type" sections, and declaration of variables which use record types. However, that is the extent of record support at the moment. You can't yet assign to records, pass records to functions, or define records inline in a "var" section.
- Debugger fixes.
0.0.8
- Now supports "type" sections. All it can really do currently is define aliases for existing types, e.g. "MyInteger = Integer;". Still needs work.
- New built-in types "Byte" and "Word". Note, however, that you currently cannot assign variables or the results of functions to Bytes or Words, because the code to handle this is not finished. You'll get an "assertion failed" error if you try.
- In the Registers window, changed registers are now highlighted in red (thanks to Michael Hieke!).
- Generates more optimized PUSH instructions.
- Debugger now catches and displays Access Violation messages.
- Many debugger fixes. (Run to Cursor quirk in 0.0.7 still exists though.)
- Some editor fixes.
0.0.7
- Added two "Debug Windows" -- Event Log and Registers.
- New "Run to Cursor" command. It has one known flaw: if you issue the "Run to Cursor" command on a line the debugger is already stopped on, it stays on that line. It should continue executing the rest of the code, and break on the line if it is encountered again.
- Title bar now displays [Run] or [Break] when the program is running or paused, respectively.
- Now "Compile" and "Run" only compile if the source has been modified. Use "Build" to force a recompile.
- Now asks if you want to recompile and restart if code is modified while the program is running.
- In the editor, it now puts green dots on lines that have generated code. (This feature still needs some work.)
- New Run Parameters option.
- Fixes to debugger and editor.
0.0.6
- Now has an integrated debugger (!). Currently all it can do is single-step the code.
- In certain cases compiler errors would be reported on the wrong line. Fixed.
0.0.5
- Includes new example "testfile.pas" which creates and writes to a file. :)
- Now supports "functions" in addition to "procedure"s. The result of a function can be assigned to a variable.
- Now supports "var" parameters in procedure declarations.
- Now supports string constants.
- Now allows a "program" reserved word at the top of a source file.
- You can now make a console app by using the compiler directive {$APPTYPE CONSOLE}.
- IDE's editor now highlights error lines (thanks to Michael Hieke). Also various fixes.
- I've made some steps to separate the compiler and the linker into two different classes.
- ...and more.