Author Topic: An easy compiler for simple programs?  (Read 1136 times)

0 Members and 1 Guest are viewing this topic.

Offline daniel1948

  • Stopped Going Outside
  • *******
  • Posts: 5215
  • Cat Lovers Against the Bomb
An easy compiler for simple programs?
« on: January 10, 2017, 10:17:30 AM »
From the Things That Piss Me Off thread, where I lamented that programming is not fun anymore, comes this problem.

I learned C on my Kaypro 2X, because Basic just wouldn't do things the way I wanted. Eventually I got an 80286 that ran DOS and for several years programming was my main hobby. I wrote some programs that I think were pretty cool, though I never considered any of them to be commercial quality. Sometimes I wrote very simple programs for a specific task, that were so quick to write that it was easier than doing the task by hand.  Then I went to Mexico to learn Spanish, and then Spain, and 6 years later when I returned, DOS was gone. Programming under Windows, being a multi-tasking OS, was "event-driven" and was so tedious it was no longer fun. Under DOS, 90% of my programming time was spent working on the algorithm that made the program perform its basic task, and 10% was spent on the user interface. But under Windows, it was the other way around: Programs took ten times as long to write and the added time was spent trying to make the user interface work, dealing with user events, etc.

C++ came along shortly before I left for Mexico, so I never learned it, and never felt the need for it, for the kind of programs I was writing.

A decade ago I switched from Windows to OS X.

I would like a compiler that runs natively on OS X and that is capable of doing all the tedious housework of creating the window and the event handling, and would allow me to write simple programs that would run in their own single window within the OS X environment, as if it were an old-fashioned OS that runs one program at a time. I don't want an emulator. I want something that runs in OS X, but allows me to write programs easily, without all the tedium of programming in a multi-tasking environment.

I'm not looking for a free compiler. I would expect to pay for something that does this, if such a thing is available. For a compiler that does what I've described, I would pay $250 without a second thought. I would not pay $1,000. Between those two, it would depend on how good it was, how well supported, etc.

I don't suppose anything like this exists, but if it does, I'd like to know about it.
Daniel
----------------
"Anyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think long and hard before starting a war."
-- Otto von Bismarck

Online Billzbub

  • Frequent Poster
  • ******
  • Posts: 2829
  • I know you know I know
Re: An easy compiler for simple programs?
« Reply #1 on: January 10, 2017, 10:20:50 AM »
I'm not an OS X guy, but my daughter is, and I'm pretty sure from what I've discussed with her that Python will meet your needs.  OS X comes with Python in some form or other, and it is closer to the command-line stuff you are used to dealing with but can provide easy-to-use user interfaces.
Quote from: Steven Novella
gleefully altering one’s beliefs to accommodate new information should be a badge of honor

Offline Johnny Slick

  • "Goddammit, Slick."
  • Poster of Extraordinary Magnitude
  • **********
  • Posts: 11990
  • Fake Ass Skeptic
Re: An easy compiler for simple programs?
« Reply #2 on: January 10, 2017, 10:28:26 AM »
I don't know if there is an OSX version, actually, but there's a free version of Visual Studio now that's almost as fully featured as the pay versions. It's called Visual Studio Community. There is a bit of a learning curve but at the same time it suuuuuuuuper simplifies a lot of aspects of setting up applications and doing some of the little things with coding, like tracking where your brackets begin and end.

If you want to go totally bare-bones and you are writing in JavaScript, you could, hell, just write everything in Notepad++ and then open up the associated HTML page through that. It's not compiling, of course, but JS doesn't compile, and you can still walk through your code using, for example, Chrome's developer tools.

I haven't used Python in years and years. As a language I remember it being super easy to use and learn since it uses whitespace as punctuation, but I have to say I kind of prefer using punctuation as punctuation. Call me "old school"!
Speak what you think now in hard words, and to-morrow speak what to-morrow thinks in hard words again, though it contradict every thing you said to-day.

- Ralph Waldo Emerson

Offline CarbShark

  • Too Much Spare Time
  • ********
  • Posts: 6416
Re: An easy compiler for simple programs?
« Reply #3 on: January 10, 2017, 10:55:26 AM »
I use AppleScript and AppleScript objective C


Sent from my iPhone using Tapatalk
and Donald Trump is President of the United States.


"Well, sometimes the magic works. Sometimes it doesn't." -- Chief Dan George, "Little Big Man"

Offline Andrew Clunn

  • Deleted
  • Poster of Extraordinary Magnitude
  • *
  • Posts: 15689
  • Aspiring Super Villain
Re: An easy compiler for simple programs?
« Reply #4 on: January 10, 2017, 10:56:31 AM »
For batch programs: python.  Simple tools that don't need complex file access: javascript + html.  You mention a GUI.  I guess to really recommend you something we need to know what kind of GUI you want / need.  How complex it has to be.  Honestly, I'm favoring platform independent languages, and actively avoiding anything put out by Google (who has a well deserved reputation for abandoning their frameworks, toolkits, and languages, even if they're popular).  If you require a lower level language (not scripting language) with hard typing, compilation, and basically something to replace c, then might I suggest Rust?
I'm just the victim of my cognitive privilege

Offline Pusher Robot

  • Frequent Poster
  • ******
  • Posts: 2205
  • Do you have stairs in your house?
Re: An easy compiler for simple programs?
« Reply #5 on: January 10, 2017, 11:09:42 AM »
If you liked C, you will probably like C#, which is very C-like but does not require manual memory management.

You can download the open source .NET Core here: https://www.microsoft.com/net/core#macos which includes the compiler.
There is a very helpful "getting started" tutorial here: https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/using-on-macos

You can download the full Visual Studio for Mac IDE which is in preview: https://www.visualstudio.com/vs/visual-studio-mac/
Or use a lightweight open-source editor called Visual Studio Code (make sure to get the C# plugin): https://code.visualstudio.com/
Or use your favorite text editor.

Out of the box, this will allow you to create class libraries and console applications.  For GUI apps, you will need to download a GUI library with .NET Core bindings, such as this one for LibUI: https://github.com/noliar/DevZH.UI

Interestingly, since .NET is an IL, you can use other languages than C# to target the same framework, such as F# (a functional language like Haskell) or IronPython.
« Last Edit: January 10, 2017, 01:01:53 PM by Pusher Robot »
A novice was trying to fix a broken Lisp machine by turning the power off and on.
Knight, seeing what the student was doing, spoke sternly: “You cannot fix a machine by just power-cycling it with no understanding of what is going wrong.”
Knight turned the machine off and on.
The machine worked.

Offline Shibboleth

  • Too Much Spare Time
  • ********
  • Posts: 7950
Re: An easy compiler for simple programs?
« Reply #6 on: January 10, 2017, 11:30:41 AM »
I don't know about for mac but there is a visual studio community version that is free and really solid. C# is good but if you want cross platform capability I would suggest JAVA for the time being but both are fine languages. If you just know some of the older languages you will or at least should teach yourself some of the object orientated code standards. That isn't to say that you can't just write procedural code with C# and Java and it will be just fine.
common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.

Offline Mr. Beagle

  • Frequent Poster
  • ******
  • Posts: 3708
Re: An easy compiler for simple programs?
« Reply #7 on: January 10, 2017, 12:10:45 PM »
I dropped the window model for my ad hoc programming and instead installed a LAMP server (Linux, Apache web server, MYSQL database and PHP), and more recently a WAMP server on my Windows 10 machine.

This requires some basic HTML knowledge, but with some simple frameworks for menus, tables and frames, it is pretty easy to output the computational results from PHP to a webpage.

PHP allows both classic procedural language writing for us Fortran/COBOL vets, but also has object-oriented functions.

As earlier noted, you can cobble something together quickly, and debug it through crashing your localhost server, though it is often inelegant. The learning curve for me was a pretty easy slope.

Mister Beagle
The real world is tri-color

Offline Andrew Clunn

  • Deleted
  • Poster of Extraordinary Magnitude
  • *
  • Posts: 15689
  • Aspiring Super Villain
Re: An easy compiler for simple programs?
« Reply #8 on: January 10, 2017, 12:16:59 PM »
Looks like we are a lot of coders with a lot of different preferred technologies and workflows.  When I hear people promoting Visual Studios as clean or Java as simple I remember that to some the node.js tool chain is an unmanageable abomination and I am often just blind to how annoying my own tool set would be for a new user.
I'm just the victim of my cognitive privilege

Offline daniel1948

  • Stopped Going Outside
  • *******
  • Posts: 5215
  • Cat Lovers Against the Bomb
Re: An easy compiler for simple programs?
« Reply #9 on: January 10, 2017, 12:36:48 PM »
Wow. Thanks for all the information.

A few points:

I am not interested in cross-platform anything. These would be little programs I'd have for my own use on my iMac. I won't be creating any graphical user interfaces, since that sounds complicated. I'd want to be able to create images on screen. If I can easily incorporate the mouse/trackpad I would, but I don't need to. I didn't have a mouse back in the day. My programs used keyboard input.

I don't want to have to re-boot into an emulator. I'd like my programs to have a icons on the desktop like all my regular programs. But if the only way to do it is through the terminal app, that would be acceptable, providing that I can draw to the screen (as opposed to text only). I'm also not really interested in creating HTML to run in a browser, though if that were the only way to get what I want, I'd consider it.

I like C because I already know it. I don't know C++, and the little I looked at it I found it confusing. And I'm a lot older than I was. I think the capacity for abstract analysis declines with age.

I'm going to look into some of the suggestions above. Thanks to everyone for the suggestions!
Daniel
----------------
"Anyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think long and hard before starting a war."
-- Otto von Bismarck

Offline Andrew Clunn

  • Deleted
  • Poster of Extraordinary Magnitude
  • *
  • Posts: 15689
  • Aspiring Super Villain
Re: An easy compiler for simple programs?
« Reply #10 on: January 10, 2017, 01:56:51 PM »
Based on that clarification, python sounds like what you want.
I'm just the victim of my cognitive privilege

Offline jt512

  • Well Established
  • *****
  • Posts: 1610
    • jt512
Re: An easy compiler for simple programs?
« Reply #11 on: January 10, 2017, 02:10:40 PM »
Wow. Thanks for all the information.

A few points:

I am not interested in cross-platform anything. These would be little programs I'd have for my own use on my iMac. I won't be creating any graphical user interfaces, since that sounds complicated. I'd want to be able to create images on screen. If I can easily incorporate the mouse/trackpad I would, but I don't need to. I didn't have a mouse back in the day. My programs used keyboard input.

I don't want to have to re-boot into an emulator. I'd like my programs to have a icons on the desktop like all my regular programs. But if the only way to do it is through the terminal app, that would be acceptable, providing that I can draw to the screen (as opposed to text only). I'm also not really interested in creating HTML to run in a browser, though if that were the only way to get what I want, I'd consider it.

I like C because I already know it. I don't know C++, and the little I looked at it I found it confusing. And I'm a lot older than I was. I think the capacity for abstract analysis declines with age.

I'm going to look into some of the suggestions above. Thanks to everyone for the suggestions!

If C worked for you before, wouldn't it still work for you now?

List of Free C Compliers

Offline daniel1948

  • Stopped Going Outside
  • *******
  • Posts: 5215
  • Cat Lovers Against the Bomb
Re: An easy compiler for simple programs?
« Reply #12 on: January 10, 2017, 02:45:56 PM »
Based on that clarification, python sounds like what you want.

Thanks, I'll check it out.

If C worked for you before, wouldn't it still work for you now?

If I was using an OS like DOS, where the program didn't have to manage the window and all the user-initiated events, and where I could write directly to the screen and query the OS for user input when and only when I wanted, yes. The problem is that the "housework" that a program has to do in a multi-tasking OS and an event-driven environment, makes writing the program so much hassle that it's not fun any more, at least for me.

My dream would be a C compiler with a function that would do all the window housekeeping. A function, perhaps called Make_Window(p,w,h), which would create a window at position p of width w and height h, and then would do all the moving and re-sizing and screen re-drawing for me, and pass keyboard inputs to my program, so that I could write the program as though it were running in a single-tasking OS like DOS, but it would actually run inside the window created by the Make_Window() function.

If I have to write all the code to move and re-size the window every time the user does that, and re-draw it every time it's exposed because another program's window moves, and deal with events as they occur, rather than just accepting input when I'm ready for it, then it's more work than I am willing to do.
Daniel
----------------
"Anyone who has ever looked into the glazed eyes of a soldier dying on the battlefield will think long and hard before starting a war."
-- Otto von Bismarck

Offline Pusher Robot

  • Frequent Poster
  • ******
  • Posts: 2205
  • Do you have stairs in your house?
Re: An easy compiler for simple programs?
« Reply #13 on: January 10, 2017, 03:07:01 PM »
You can do that with the LibUI library for C#:

Code: [Select]
namespace DevZH.UI.SimpleSample

{

    public class Program

    {

        public static void Main(string[] args)

        {

            var app = new Application();

            var window = new MainWindow("libui Control Gallery", 640, 480, true);

            window.AllowMargins = true;

            app.Run(window);

        }

    }

}
A novice was trying to fix a broken Lisp machine by turning the power off and on.
Knight, seeing what the student was doing, spoke sternly: “You cannot fix a machine by just power-cycling it with no understanding of what is going wrong.”
Knight turned the machine off and on.
The machine worked.

Offline ilchymis

  • Brand New
  • Posts: 1
Re: An easy compiler for simple programs?
« Reply #14 on: May 10, 2017, 05:30:47 AM »
If C worked for you before, wouldn't it still work for you now?

If I was using an OS like DOS, where the program didn't have to manage the window and all the user-initiated events, and where I could write directly to the screen and query the OS for user input when and only when I wanted, yes. The problem is that the "housework" that a program has to do in a multi-tasking OS and an event-driven environment, makes writing the program so much hassle that it's not fun any more, at least for me.

You've hinted in a previous response that you want a GUI framework to take care of window and event management for you, but I'm having a hard time envisioning exactly what level of abstraction is appropriate here. In order to behave properly in a modern windowing environment, your app will need to respond to window resizes and other events; using a framework that handles these automatically while letting you draw on a fixed-dimension virtual canvas might simplify your programming experience, but whether that would work well depends on what you'd like to create. What specifically do you have in mind?

More crucially: Because most GUI frameworks run a single GUI thread, you'll also have to adopt an event-driven programming model, which is different from what you would have used on DOS. This represents a fundamental change in programming style that you probably can't avoid, at least not in most frameworks I'm familiar with.

I'd recommend embracing the event-driven programming style, since it tends to permeate modern GUI environments. The good news is that once you've crossed that threshold, a whole world of programming interfaces will open up to you.

Like other posters on this thread, I would recommend Python as a go-to general purpose programming language, particularly when combined with its built-in Tk GUI toolkit. C is still C, however, and there also exist perfectly good C and C++ GUI toolkits (I'm particularly fond of Qt.).

 

personate-rain
personate-rain