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
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#46 Post by smokey01 »

Lobster, would the space between the dot and the c be the problem?

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

BaCon 101

#47 Post by mechanic »

BaCon 101

Download the source:

http://www.basic-converter.org/bacon.bac

If you don't have a compiled bacon executable, also download this:

http://www.basic-converter.org/bacon.bash

Open a terminal in the download folder and type:

Code: Select all


./bacon.bash bacon.bac

When it finishes you will have a bacon executable, place in the /usr/bin/ or /usr/local/bin/ folder.

Now to translate/compile a *.bac file just do:

Code: Select all


bacon yourfile.bac

See the docs here:

http://www.basic-converter.org/documentation.html

You should be good to go!

Anytime you download a new version, you'll have to do recompile the bacon source using the old bacon executable. Unless Peter adds something new that breaks the old version this will work. Otherwise you'll need to get the bacon.bash version and compile the new bacon executable with it. Peter always releases new versions of both at the same time so this should always work.

HTH
regards,
mechanic

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

#48 Post by Lobster »

Thanks guys. You may have saved my bacon.

Oink Oink
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#49 Post by amigo »

Be sure and bring some of that bacon home.

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#50 Post by Mobeus »

Hi guys,

bacon-bash needs bash 4. Here is the bacon-1.19 binary that I use in lupu if anyone needs it. It goes in /usr/bin and does not need bash 4.
Attachments
bacon-1.19.tar.gz
(90.78 KiB) Downloaded 494 times
/root for the home team

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#51 Post by Mobeus »

I think BaCon is the Puppy Linux programming language I've been looking for years for. I rebuilt my GTK Firewall_Genie using BaCon instead of Genie/vala. Take a look at this these dependencies!

Bacon

Code: Select all

 # ldd ./Firewall_Genie
	linux-gate.so.1 =>  (0xffffe000)
	libm.so.6 => /lib/libm.so.6 (0xb7807000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7803000)
	libc.so.6 => /lib/libc.so.6 (0xb76b9000)
	/lib/ld-linux.so.2 (0xb782f000) 
Genie

Code: Select all

# ldd ./Firewall_Genie
	linux-gate.so.1 =>  (0xffffe000)
	libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb74f1000)
	libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb74ca000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb7453000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7423000)
	libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7407000)
	libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7371000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb7357000)
	libm.so.6 => /lib/libm.so.6 (0xb7330000)
	libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0xb7292000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb7286000)
	libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb7243000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb71c9000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb7189000)
	libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb7183000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb717e000)
	librt.so.1 => /lib/librt.so.1 (0xb7175000)
	libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb70ab000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7092000)
	libc.so.6 => /lib/libc.so.6 (0xb6f49000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb6e2c000)
	libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0xb6e28000)
	libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb6e24000)
	libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb6e1e000)
	libz.so.1 => /lib/libz.so.1 (0xb6e08000)
	libexpat.so.1 => /lib/libexpat.so.1 (0xb6de1000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0xb6dd1000)
	libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb6dc7000)
	libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb6dc3000)
	libXi.so.6 => /usr/lib/libXi.so.6 (0xb6db4000)
	libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb6dac000)
	libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb6da2000)
	/lib/ld-linux.so.2 (0xb78c8000)
	libdl.so.2 => /lib/libdl.so.2 (0xb6d9e000)
	libpcre.so.3 => /lib/libpcre.so.3 (0xb6d6d000)
	libresolv.so.2 => /lib/libresolv.so.2 (0xb6d58000)
	libselinux.so.1 => /lib/libselinux.so.1 (0xb6d3d000)
	libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb6ce3000)
	libdirectfb-1.2.so.0 => /usr/lib/libdirectfb-1.2.so.0 (0xb6c6c000)
	libfusion-1.2.so.0 => /usr/lib/libfusion-1.2.so.0 (0xb6c62000)
	libdirect-1.2.so.0 => /usr/lib/libdirect-1.2.so.0 (0xb6c4b000)
	libpng12.so.0 => /lib/libpng12.so.0 (0xb6c26000)
	libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0xb6c21000)
	libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0xb6c19000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb6bff000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb6bfa000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb6bf4000)
 
8)
/root for the home team

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

#52 Post by seaside »

Mobeus wrote:I think BaCon is the Puppy Linux programming language I've been looking for years for. I rebuilt my GTK Firewall_Genie using BaCon instead of Genie/vala. Take a look at this these dependencies!

Mobeus,

Wow, that is just amazing and let me be sure I understand the differences. The first binary was built with Genie/vala and the second was re-written in Basic and then converted with Bacon and compiled.

Any perceptible execution speed differences as well?

Cheers,
s

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

#53 Post by BarryK »

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
[url]https://bkhome.org/news/[/url]

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

a little notify demo

#54 Post by vovchik »

Dear Puppians,

This is a little demo of a scrolling notify box with markup. I still have to remove a few HUG dependencies to reduce the binary size and to add geometry and duration to the passed argument list for more user control. Have a look. I, too, think BaCon is great and easy. Doyle is working on simplifying some of the GTK calls and Peter is improving BaCon regularly. The attached archive includes source and a binary.

With kind regards,
vovchik

PS. Mark's GTKbasic interpreter is also very good for scripting with guis. You just have to get used to it.
Attachments
bac-notify-src.tar.gz
(32.51 KiB) Downloaded 548 times

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#55 Post by Mobeus »

seaside

Yes that’s pretty much it. The gui is a gtkbuilder glade file in Genie. In BaCon I changed the gtkbuilder glade file to be just glade, then ran it through Doyles mkglade utility to generate the application skeleton (which does away with the separate glade file) then just compiled it with BaCon after adding my other code. The final binary is about the same size and I see no loss of speed at all. I wonder if those dependencies are entirely accurate though, since it does require gtk2.

If this forum had a 'dancing with joy' emoticon you would see one here :D
/root for the home team

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

#56 Post by 2lss »

Does anybody out there have bacon syntax highlighting configuration file for Geany? (the GtkSourceView file from the main site does not work).

If not I will take a stab at creating one.

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

geany config file for bacon

#57 Post by vovchik »

Dear 2lss,

I didn't actually create a separate BaCon one, but about half a year ago I included BaCon keywords in the FreeBasic file. Here it is. In the meantime, Peter has added some statements and functions, so, if you want to have a go, please do. My freebasic/bacon geany file is attached. If you download Peter's tiny Basic IDE and compile it and start it, it will update the GTKSourceview file automatically from Peter's site.

With kind regards,
vovchik
Attachments
filetypes.freebasic.tar.gz
(2.48 KiB) Downloaded 478 times

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

better bac-notify example

#58 Post by vovchik »

Dear Puppians,

Try out the code below with bac-notify. It shows what can be done more clearly than the example included in the archive.

Code: Select all

#!/bin/bash

# Note: when passing a span string containing double quotes,
# be sure to escape the quotes with a backslash (\). Also, use
# the pipe character (|) # for generating a newline.
# If you don't have a font specified in a span command
# installed on your system, GTK will use your default font
# (e.g. 1960s Hippie in the first $mytext below will display as DejaVu Sans). 

# grab start time
before=`date +%s`

# This is the first string to display via bac-notify

mytext="Hi there!|
<span weight=\"ultrabold\" color=\"red\" font-family=\"1960s Hippie\" size=\"xx-large\">
This is <u>BIG RED</u> text
</span>
|and <i>this</i> is <u>another</u> line...|
<span weight=\"ultrabold\" color=\"blue\">
passed to <big>bac-notify</big> via bash.
</span>"

# OK, let's display the first string

./bac-notify "$mytext" &
echo "bac-notify launched..."


# Wait a bit
sleep 5

# OK, now the second string

mytext="This is a second message!|
<span weight=\"ultrabold\" color=\"#2A8F15\" font-family=\"DejaVu Serif\" size=\"xx-large\">
The notifications will <u>be overlaid</u>
</span>
|and placed <i>on top of</i> one <u>another</u>...|
<span weight=\"ultrabold\" color=\"#A3120D\" size=\"xx-large\">
Blood Red is GROOVY, isn't it<big>!?</big>
</span>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# OK, now the third string

mytext="<small>
<span font-family=\"DejaVu Sans Mono\">
BaCon is a free BASIC to C converter for Unix-based systems.|
The following design goals were followed:|
    * Must run on each Unix/Linux/BSD platform, including MacOSX|
    * Converted sourcecode must be compilable with GCC|
    * Must resemble genuine BASIC with implicit variable delarations|
    * Spoken language constructs are preferred|
To use Bacon your system must have the Korn Shell or Bourne Shell.
</span></small>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# OK, now the fourth string

mytext="
<span font-family=\"DejaVu Sans\" weight=\"ultrabold\" color=\"red\" size=\"xx-large\">
       CONGRATULATIONS!|
</span>
<span style=\"oblique\" color=\"blue\">
You have just successfully downloaded the entire content|
of all websites indexed by Google to your USB stick :)
</span>"

./bac-notify "$mytext" &
echo "bac-notify launched..."

# Wait a bit
sleep 5

# grab end time
after=`date +%s`
elapsed_seconds=`expr $after - $before + 5`

# Finally, the fifth and last string

mytext="<span weight=\"ultrabold\" color=\"blue\" font-family=\"DejaVu Sans\" size=\"xx-large\">
  BYE-BYE</span>|
<b><big>from bac-notify...</big></b>|
Demo time: $elapsed_seconds seconds"


./bac-notify "$mytext" &
echo "bac-notify launched..."

exit 0
With kind regards,
vovchik
Last edited by vovchik on Mon 08 Nov 2010, 13:41, edited 1 time in total.

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

#59 Post by BarryK »

2lss wrote:Does anybody out there have bacon syntax highlighting configuration file for Geany? (the GtkSourceView file from the main site does not work).

If not I will take a stab at creating one.
Geany does not use Gtksourceview, but NicoEdit does. Many Puppies have NicoEdit built-in, or it is a PET that you can install with the package manager.

Wary and Quirky have NicoEdit, and the BaCon highlighter file.
Except, on latest Wary we have a problem with NicoEdit crashing.
[url]https://bkhome.org/news/[/url]

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

#60 Post by 2lss »

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

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 :)

Post Reply