BaCon - Bash-based Basic-to-C converter/compiler
Bash and Bacon versions
Dear Doyle,
I am using the latest BaCon - released last night BaCon (version 1.0 build 18 beta). It is in the /beta dir on Peter's site. My bash is 3.2.29(2)-release (i486-slackware-linux-gnu). It is a version that is recent enough to work with BaCon (and still in the 3.x series). So bash and BaCon aren't causing the problem. I usually update BaCon every few days. So I am still scratching my head.
With kind regards,
vovchik
I am using the latest BaCon - released last night BaCon (version 1.0 build 18 beta). It is in the /beta dir on Peter's site. My bash is 3.2.29(2)-release (i486-slackware-linux-gnu). It is a version that is recent enough to work with BaCon (and still in the 3.x series). So bash and BaCon aren't causing the problem. I usually update BaCon every few days. So I am still scratching my head.
With kind regards,
vovchik
I fixed it!
Dear Doyle,
I finally found out what was wrong. When assigning values to a RECORD element, you have to use the "WITH/END WITH" construction. My fix is attached. No more garbage SUBs.
With kind regards,
vovchik
I finally found out what was wrong. When assigning values to a RECORD element, you have to use the "WITH/END WITH" construction. My fix is attached. No more garbage SUBs.
With kind regards,
vovchik
- Attachments
-
- mkglade-4c.tar.gz
- (18.37 KiB) Downloaded 950 times
Re: I fixed it!
Great! Now I can concentrate on some other buggy items. I need to figure out how to ignore some of the widget classes that don't use signals - like "GtkVBox", etc. Right now the parser grabs all of the classes.vovchik wrote:Dear Doyle,
I finally found out what was wrong. When assigning values to a RECORD element, you have to use the "WITH/END WITH" construction. My fix is attached. No more garbage SUBs.
With kind regards,
vovchik
Now if only I had a handy list...
regards,
mechanic
mechanic
Re: I fixed it!
Well, I hate to quote myself but I made a list of the available widgets which use signals and added it to the source in the form of DATA statements. Now mkglade don't add the widget class unless it is one that uses signals. This should make it a little faster parsing a glade file.mechanic wrote: Now if only I had a handy list...
I hope that I didn't miss any widgets, if so please let me know.
- Attachments
-
- mkglade-4d.tar.gz
- (3.66 KiB) Downloaded 1012 times
regards,
mechanic
mechanic
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
Some new Bacon 1 build 19 was released on 31 October.
http://www.basic-converter.org/
I need a tutorial - starting with 'Hello world'
I have the devx running
It compiles c code - then I think I get stuck
trying to compile it . . .
is that right?
gosh I should know this . . .
http://www.basic-converter.org/
I need a tutorial - starting with 'Hello world'
I have the devx running
It compiles c code - then I think I get stuck
trying to compile it . . .
is that right?
Code: Select all
gcc -c t.bac.c
BaCon 101
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:
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:
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
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
Now to translate/compile a *.bac file just do:
Code: Select all
bacon yourfile.bac
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
mechanic
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.
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 497 times
/root for the home team
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
Genie
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)
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)
/root for the home team
Mobeus,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!
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
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
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
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]
a little notify demo
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.
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 551 times
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
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
/root for the home team
geany config file for bacon
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
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 481 times
better bac-notify example
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.
With kind regards,
vovchik
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
vovchik
Last edited by vovchik on Mon 08 Nov 2010, 13:41, edited 1 time in total.
- BarryK
- Puppy Master
- Posts: 9392
- Joined: Mon 09 May 2005, 09:23
- Location: Perth, Western Australia
- Contact:
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.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.
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]
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)
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 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
Anyway, I'm going to give vovchik's file a go and see what I can come up with