CordyJ / Open-TuringPlus

Open Turing+ programming language compiler
Other
8 stars 2 forks source link

It seems that the "emit line numbers" functionality isn't working #5

Closed mingodad closed 4 months ago

mingodad commented 4 months ago

While testing building OpenTxl I removed the -O option to get line numbers in the generated C code but no line numbers info is emitted:

tpc-env make csrc
make -f Makefile-C
make[1]: Entering directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
/bin/rm -rf csrc
make -f Makefile-C clean
make[2]: Entering directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
/bin/rm -rf csrc
make[2]: Leaving directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
make -f Makefile-C C TPCFLAGS="-w -DLATIN1 -DUNICODE -mUNIX64"
make[2]: Entering directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
mkdir csrc
/bin/rm -f csrc/txl.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/txl.t
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv txl.c csrc/txl.c
/bin/rm -f csrc/parse.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/parse.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv parse.c csrc/parse.c
/bin/rm -f csrc/xform.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -w -A -q4 src/xform.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv xform.c csrc/xform.c
/bin/rm -f csrc/comprul.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/comprul.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv comprul.c csrc/comprul.c
/bin/rm -f csrc/compdef.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/compdef.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv compdef.c csrc/compdef.c
/bin/rm -f csrc/loadstor.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/loadstor.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv loadstor.c csrc/loadstor.c
/bin/rm -f csrc/locale.c
cp src/locale.c csrc/locale.c
/bin/rm -f csrc/main.c
cp src/main.c csrc/main.c
/bin/rm -rf csrc/tpluslib
cp -r src/tpluslib csrc/tpluslib
/bin/rm -f csrc/xformdb.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -w -DDEBUGGER -DTIMING -A -q4 src/xform.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv xform.c csrc/xformdb.c
/bin/rm -f csrc/txlsa.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -DNOCOMPILE -DSTANDALONE -A -q4 src/txl.t
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv txl.c csrc/txlsa.c
/bin/rm -f csrc/loadsa.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -DNOCOMPILE -DSTANDALONE -A -q4 src/loadstor.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv loadstor.c csrc/loadsa.c
/bin/rm -f csrc/parsa.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -DNOCOMPILE -DSTANDALONE -A -q4 src/parse.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv parse.c csrc/parsa.c
/bin/rm -f csrc/txlcvt.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/txlcvt.t
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv txlcvt.c csrc/txlcvt.c
/bin/rm -f csrc/xformpf.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -w -DPROFILER -A -q4 src/xform.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv xform.c csrc/xformpf.c
/bin/rm -f csrc/parsepf.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -DPROFILER -A -q4 src/parse.ch
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv parse.c csrc/parsepf.c
/bin/rm -f csrc/txlapr.c
tpc -w -DLATIN1 -DUNICODE -mUNIX64 -A -q4 src/txlapr.t
/home/mingo/local/tpc/bin /home/mingo/dev/c/A_grammars/txl/OpenTxl
mv txlapr.c csrc/txlapr.c
make[2]: Leaving directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
cp src/makefiles/c/Makefile csrc/Makefile
cp src/readmes/c/README.txt csrc/README.txt
cp LICENSE.txt csrc/LICENSE.txt
mkdir csrc/bin
cp src/scripts/c/* csrc/bin
mkdir csrc/distrib
cp -r src/distrib/c/* csrc/distrib
cp -r -P test csrc/test
make[1]: Leaving directory '/home/mingo/dev/c/A_grammars/txl/OpenTxl'
CordyJ commented 4 months ago

What made you think that tpc can emit C with line numbers? You asked it to emit C code (-q4 -A) not object code.

mingodad commented 4 months ago

The original Makefile-C have this TPCFLAGS = -O and tpc -hshows this -O : Do not emit run time line numbering and checking code..

CordyJ commented 4 months ago

The original Makefile-C have this TPCFLAGS = -O and tpc -hshows this -O : Do not emit run time line numbering and checking code..

Doesn't apply to -q4 -A.

mingodad commented 4 months ago

So I can remove -q4 -A and get line numbering ?

CordyJ commented 4 months ago

So I can remove -q4 -A and get line numbering ?

Just use make clean followed by make in the main directory instead of make csrc to get the default run-time line numbering and checking of the compiled Turing+ source code. That's how we maintain and debug Turing+ and TXL.

The generated csrc version, which you get from make csrc is to generate optimized code for the C machine in order to have both good performance and portability at the same time. Nothing in the generated csrc directory is for human consumption.

mingodad commented 4 months ago

Thank you again for reply ! On my computer I need to replace pushd/popd in Makefile because by default it doesn't uses bash:

 # Bootstrap

 src/bootgrm.i : src/bootstrap/bootgrm.i
-   pushd src/bootstrap; make; popd 
+   cd src/bootstrap; make; cd ../..
    cp src/bootstrap/bootgrm.i src/bootgrm.i
CordyJ commented 4 months ago

On my computer I need to replace pushd/popd in Makefile because by default it doesn't uses bash:

Thanks! What is your platform? On all of the portability test platforms (MacOS Sonoma, Ubuntu Linux 20.04 LTS, Cygwin64/WIndows, Msys64/WIndows) the Makefile works fine.

CordyJ commented 4 months ago

Note to maintainer:

# Bootstrap

src/bootgrm.i : src/bootstrap/bootgrm.i
    (cd src/bootstrap; make)
    cp src/bootstrap/bootgrm.i src/bootgrm.i