BaCon - Bash-based Basic-to-C converter/compiler

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

nicoedit and bacon

#61 Post by vovchik »

Dear 2lss,

I tried the same today - to get nicoedit to recognize the BaCon lang file and failed. I copied it to the location where nicoedit keeps its lang files and could not find any other nicoedit config file where lang files would be listed. I was also too lazy to look at the nicoedit source. So, I am back to geany.

With kind regards,
vovchik

PS. Peter's little bacon-IDE has great potential here. It would need tabs (and multiple buffers), command-line arguments, comment/uncomment code, indent/unindent and search/replace. Anybody willing to take on the task?

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Better version of bac-notify

#62 Post by vovchik »

Dear Puppians,

Here is an improved version of bac-notify. It doesn't flicker and you can now kill a popup window immediately with a mouse click, thanks to Peter, who added a bit to the code.

With kind regards,
vovchik
Attachments
bac-notify-src.tar.gz
(25.47 KiB) Downloaded 466 times

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#63 Post by BarryK »

2lss wrote:Thanks vovchik and BarryK for your suggestions.

I gave nicoedit a try but for some reason the syntax highlighting does not want to work for bacon. (works ok for c, xml, etc)

I copied bacon.lang to /use/share/gtksourceview-2.0/language-specs and then ran "check.sh" on it, which said "bacon.lang validates."

I'm also getting a gtksourceview related error when I start Nicoedit (regardless of the extension)

Code: Select all

(nicoedit:18591): GtkSourceView-CRITICAL **: gtk_source_language_manager_get_language: assertion `id != NULL' failed
I don't think the problem is the bacon.lang file since it works for me in gEdit on Ubuntu. (using puppeee 4.3 now)


Anyway, I'm going to give vovchik's file a go and see what I can come up with
I have just tried it in Wary. The file bacon.lang is already present.

Running direct from commandline:

# nicoedit demo.bac

...and it comes up syntax highlighted.

Start nicoedit, choose File -> Open to open demo.bac, I also get syntax highlighting.

However, looking in View -> Coloration mode, it lists as "Text". It seems that the source code of nicoedit needs to be modified to include BaCon in the list.

But apart from that, I do get syntax highlighting.
[url]https://bkhome.org/news/[/url]

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#64 Post by ttuuxxx »

If you go t o the link below it explains how to add bacon to gtksourceview

http://www.allbasic.info/mboard/index.p ... opic=888.0

ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#65 Post by ttuuxxx »

compiled the latest bacon bin for 2.14X and added the bacon TinyIde to the package
http://www.murga-linux.com/puppy/viewto ... 156#466156
:) until I get/workout the updates for geany
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#66 Post by ttuuxxx »

There's 3 things I would like to see in TinyIde
1- word search, kind of a pain manually searching code
2 for it to remember where things are like when you set the location of bacon as the compiler, and then you shut down the editor and restart it, you have to set it again. maybe just hardcode that its located in usr/bin
Plus it states to have xterm, would be nice if you could set that to rxvt
3 like alway, I would like tabs :)
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

NinerSevenTango
Posts: 186
Joined: Sun 17 Jun 2007, 18:25

#67 Post by NinerSevenTango »

BarryK wrote:Guys,
I have it on my to-do list to play a bit with BaCon!

To that end, I put BaCon in the 'devx' sfs in Wary and Quirky. The BaCon compiler is a compiled binary, so does not need Bash4. But of course, to compile BaCon I had to install Bash4 -- and the Puppy Package Manager has a Bash4 PET package, in case you want it.

The latest Wary, 0.9.6, has BaCon 1.0.17.

The 'devx' sfs also has documentation:

/usr/share/BaCon/documentation.pdf.

Wary Puppy:
http://bkhome.org/blog/?viewCat=Wary
After reading that you had temporarily installed Bash4 to compile BaCon, I installed KSH and compiled it, then uninstalled KSH.
I ran into some problems compiling some of the demo programs. Turns out you need to have Bash4 installed even if BaCon is compiled properly.

I was worried that installing Bash4 and leaving it might break some scripts.

Well, after running into library hell trying to get it all working and eventually borking that Lupu 511 install, I'm now running a full install of Quirky. I've gone ahead and installed Bash4 (wish I'd known about that PET, hehe). I haven't seen anything broken yet, but I'm waiting for something to show up.

Now, to start over with BaCon again .....

--97T--

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#68 Post by BarryK »

The next Wary Puppy, probably version 097, that I expect to release in 2-3 days, has BaCon support all setup and ready to go. See blog announcement:

http://bkhome.org/blog/?viewDetailed=01950

Also, see my BaCon intro page:

http://bkhome.org/bacon/
[url]https://bkhome.org/news/[/url]

NinerSevenTango
Posts: 186
Joined: Sun 17 Jun 2007, 18:25

#69 Post by NinerSevenTango »

Awesome, Barry.

Thanks for all you do!

--97T--

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#70 Post by Lobster »

Open a terminal in the download folder and type:
./bacon.bash bacon.bac
Hey mechanic, fellow Baconites,
did all that . . .

Code: Select all

# ./bacon.bash bacon.bac
Starting conversion... 659   Segmentation fault
# ./bacon.bash bacon.bac
Starting conversion... 644   
ERROR: variable in LOCAL statement at line 644 in file 'bacon.bac' was defined previously!
# 
does it not like my 64bit processor?
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Lobster's 64 bits

#71 Post by vovchik »

Dear Lobster,

I am not on 64 bits but Peter, the developer of BaCon, is and has no problems. You should probably have the 64-bit version of bash installed Actually, everybody has been talking about how you need version 4.0, but I blithely work with GNU bash version 3.2.29(2)-release i486-slackware-linux-gnu and have NO problems. . I have been using this version of bash since discovering BaCon way back.

One of these days I will switch to bash 4.0, but, at the moment, I don't want to break anything. One small irritation I have with my bash, however, is that I have to have a line feed chr(10) after the last line of code, otherwise the compiler won't grab it. So I always just hit enter after the last command in the source. Try that, too.

And please report your results. We have to get you to be able to compile stuff....

With kind regards,
vovchik

mechanic
Posts: 29
Joined: Sun 12 Apr 2009, 20:20

BaCon problems

#72 Post by mechanic »

Lobster wrote:
Open a terminal in the download folder and type:
./bacon.bash bacon.bac
Hey mechanic, fellow Baconites,
did all that . . .

Code: Select all

# ./bacon.bash bacon.bac
Starting conversion... 659   Segmentation fault
# ./bacon.bash bacon.bac
Starting conversion... 644   
ERROR: variable in LOCAL statement at line 644 in file 'bacon.bac' was defined previously!
# 
does it not like my 64bit processor?
Eeek! I don't know about the 64bit processor but I doubt that is the problem. Here is what I get on my system:

Puppy Lucid 5.01

# uname -a
Linux puppypc 2.6.33.2 #1 SMP Mon Apr 5 12:55:04 Local time zone must be set--see zic m i686 GNU/Linux

# gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# bash --version
bash --version
GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

# ./bacon.bash -v

BaCon version 1.0 build 18 - (c) Peter van Eerten - GPL v3.

# ./bacon.bash bacon.bac
Starting conversion... done.
Starting compilation... done.
Program 'bacon' ready.

# bacon -v
bacon -v

BaCon version 1.0 build 19 - (c) Peter van Eerten - GPL v3.

As you can see, I used version 18 of bacon.bash to compile version 19 of the bacon binary here. I just did it again to make sure it works as I described and it does. I had to update bash here in order for bacon to work (version 4.1.5) but vovchik is using a older version and it works fine for him.

I would look at updating bash and see if that helps. Sorry your having so much trouble, we need you compiling apps. :-)
regards,
mechanic

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#73 Post by seaside »

Some points to mention again:

Most Puppys are bash 3 and won't compile bacon.

Check bash version in terminal

Code: Select all

bash --version
Temporarily install bash 4 by renaming /bin/bash to /bin/bashFORMER and copying the bash 4 file to /bin/bash.

You can then

Code: Select all

./bacon.bash bacon.bac 
to compile a bacon executable.

You can now remove /bin/bash and rename /bin/bashFORMER to /bin/bash and you're back to bash 3.

The bacon executable you just made will operate in the bash 3 environment merryily translating and compiling away. If a new version of bacon is released, you MAY be able to compile it with the existing bacon executable, but don't count on it and you might have to temporarily
install bash 4 again.

One other thing that caught me was saving files from the www.basic-converter.org site. If you save code examples, using the browser-save-as-text file option, errant characters crop up in the source code. So, be sure to use copy and paste only.

Cheers,
s

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#74 Post by big_bass »

two small scripts to get started with BaCon
first script auto downloads complies bacon and installs it
nice for when a new version comes out

*you have to have a devx or a " compiler" installed
TXZ pup has the latest bash built in

the second ¡s a dragNdrop script that compiles any *.bac
automatically

Code: Select all

#!/bin/bash

# getting started with bacon by  Joe Arose 
# this will download and compile the latest bacon and install it 
rm -f  bacon.bash*
rm -f  bacon.bac*
rm -f  bacon

xterm  -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bash
chmod a+x bacon.bash


xterm  -geometry 40x30+150+40 -e wget http://www.basic-converter.org/bacon.bac
chmod a+x bacon.bac


xterm  -geometry 40x30+150+40 -e ./bacon.bash bacon.bac

# copy bacon bin into the path 
cp bacon /usr/sbin


Xdialog --title "Complete" \
        	--infobox "\nInstalling bacon has finished.\n" 0 0 3000


a drag N drop bac compiler just drag N drop any *.bac file on the script to compile it to a binary

Code: Select all

#!/bin/sh

# call this dnd-bac-compiler

# a drag N drop bac  compiler    jut drag N drop any *.bac file on the  
# script to compile it to a binary 
# run the binary by opening a terminal ./name of the binary 

xterm  -geometry 40x30+150+40 -e ./bacon.bash "$@"

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#75 Post by Lobster »

seaside wrote: Most Puppys are bash 3 and won't compile bacon.
Wot?
I am at the cutting edge of 5.2 Lucid usage . . .

This is what I get:

Code: Select all

# bash --version
GNU bash, version 3.00.16(1)-release (i486-t2-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
# 
:oops:
. . . not even cutting edge :roll:

All I want is bacon and hugs
(The Bacon GUI environment)

Appreciate your support guys
Will see if I can update Bash

Theoretically Bacon wrote the plays of Shakespeare
(yep another tin hat, tin pot conspiracy theory)

To Bacon or not to Bacon
That is the Question

[Lobster rambles off into the distance . . .]

Puppy Linux
Tin Hat Friendly
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

2lss
Posts: 225
Joined: Sun 20 Sep 2009, 23:54

#76 Post by 2lss »

BarryK wrote:The next Wary Puppy, probably version 097, that I expect to release in 2-3 days, has BaCon support all setup and ready to go. See blog announcement:

http://bkhome.org/blog/?viewDetailed=01950

Also, see my BaCon intro page:

http://bkhome.org/bacon/
Thanks Barry, I'm going to give this a try.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#77 Post by BarryK »

2lss wrote:
BarryK wrote:The next Wary Puppy, probably version 097, that I expect to release in 2-3 days, has BaCon support all setup and ready to go. See blog announcement:

http://bkhome.org/blog/?viewDetailed=01950

Also, see my BaCon intro page:

http://bkhome.org/bacon/
Thanks Barry, I'm going to give this a try.
I have uploaded Wary 097, which has all the bacon goodies in it. I am having a sound problem, which I why I haven't formally announced 097 on my blog, and 098 will be uploaded soon. But 097 should be fine for BaCon development -- and most likely you won't even get the sound problem.

Get 097 from here:
http://distro.ibiblio.org/pub/linux/dis ... /wary-097/
[url]https://bkhome.org/news/[/url]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#78 Post by BarryK »

Note, I think that some of the .bac include files are broken in Wary 097, /usr/local/BaCon -- I created them by opening the .bac.html files on the BaCon website and saving them as plain text -- but the files have lots of '*' characters everywhere.

Note that Wary 097 has a compiled /usr/bin/bacon compiler, so doesn't need Bash 4.x.
[url]https://bkhome.org/news/[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#79 Post by Lobster »

Note, I think that some of the .bac include files are broken in Wary 097
:shock:

Downloaded and setup 097 (sound worked on initial boot and then never again - no persistence)

ahem . . .

Downloaded and setup 097

then went to usr/share/BaCon

Code: Select all

# bacon c calculator.bac
Starting conversion... done.   
Starting compilation... done.
Program 'calculator' ready.
I have pork

Code: Select all

# ./calculator 

-= BACON Calculator =-

1) Perform addition
2) Perform substraction
3) Perform multiplication
4) Perform division
5) Quit
Sadly hug.bac, editor.bac
etc are broken as mentioned

Code: Select all

# bacon c glade.bac
Starting conversion... 28   
ERROR: could not parse line 28 in file 'glade.bac'!
# bacon c editor.bac
Starting conversion... done.   
Starting compilation... Compiler emits messages!

Problem:
	 file 'editor.bac' line 227: WRITELN "font ", ptr1 TO settings
Cause:
	 incompatible type for argument 1 of '__b2c__str'
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Ray MK
Posts: 774
Joined: Tue 05 Feb 2008, 09:10
Location: UK

#80 Post by Ray MK »

Hi Barry

Just a note to say Wary 097 seems fine - all the basic's,
from a n00b viewpoint seem to work.

Woof woof at startup ok, nico edit seems fine, using it now.

Wired internet - good. Not tried wifi yet, or dialup.

Had to setup mouse tapping - no prob's.
(051 tapping worked auto-magically)

097 not quite so snappy as 051 -
(guessing thats because of extra drivers etc)

Manual frugal to sda1 ext3, 256mb ram,
Celeron 2.5Ghz proc, 700mb swap partition,
Acer Travelmate 243LC laptop. approx 8yrs old.

Very best regards and many thanks for all you do - Ray

Post Reply