NAME
       comp - a simple pascal Compiler

SYNOPSIS
       comp [ -Osb filename ] sourcefile


WARNING
       This is no way a standard PASCAL compiler. It is a PASCAL
       subset compiler defined in P1(Project Experiment 1). Moreover,
       it generates necessarry assembly codes to run on a simulated 
       CPU only.

DESCRIPTION
       comp compiles a PASCAL-subset program defined in P1(Project
       experiment 1: Compiler Construction). It compiles a source
       program in only one stage: by generating necessary assembly
       codes to run on a simulated CPU. However, you can produce
       machine codes by using the -b option which uses 'asm'(the
       assembler) in return.

OPTIONS
       comp recognizes following options:

	 -s file.asm 
	      Place assembly codes in the file 'file.asm'. If -s
	      option is not used a default file 'a.asm' is used
	      instead.

	 -b file.x
	      Place machine codes in the file 'file.x'. If -b is
	      not used machine code is not produced.

	 -O file.asm
	      same as -s. However, the author wanted to use this
	      option for Optimization. Since, Optimization is not
	      yet implemented, it is not used. 

EXAMPLES
       The easiest way to compile a program using this compiler is:

	      comp file.pas

       where 'file.pas' is the source file. In the above example,
       assembly code is placed in the file 'a.asm'(default file).
       If output is needed to be place in another file, you can
       specify:

	      comp -s file.asm file.pas

       It places output in the file 'file.asm'. Machine codes can
       be place using the -b option:

	      comp -s file.asm -b file.x file.pas
	   
       It places machine codes in the file 'file.x', as well as the
       assembly codes in the file 'file.asm'.

       To assemble and run a assembly code program use:
	      
	      asm input-file [output-file]
	      sr output-file

SEE ALSO
       asm, sr.

BUGS and WARNINGS
       o The both programs written below should work:

              program test1;
              var i;
              begin
                  i := 5;
                  write i   <---- No semicolon
              end.

	      ........... 

              program test2;
              var i;
              begin
                  i := 5;
                  write i; <---- Semicolon is right here. 
              end.

       o DATA SEGMENT cannot be greater than 1000 byte. However, you
	 can recompile the program and change the definition in the
	 code_generator.c like:
	    
	      #define BASE_TEMP_MEMORY 1000

	 to,

	      #define BASE_TEMP_MEMORY 10000 

         or whatever the value is permitted.

       o -b option assumes that asm(the assembler) resides as '../asm',
	 e.i., one-step up to the directory tree. You can redife it by
	 changing the definition in main.c from:

              #define  ASM     "../asm"

	 to

              #define  ASM     "your_asm_path"

         And compile it!  However, it should be a option redifinable 
	 from the 'comp'!  But I was lousy to do implement it.

AUTHOR
       Chakma Junan <jchakma@yahoo.com> 
       Information and Computer Sciences
       Toyohashi University of Technology.
       (It was originially implemented by: ohno@edu.tut.ac.jp)

       Last Updated: Sun Feb 13 19:53:10 JST 2000
