Programming Languages

1392 readers
4 users here now

Hello!

This is the current Lemmy equivalent of https://www.reddit.com/r/ProgrammingLanguages/.

The content and rules are the same here as they are over there. Taken directly from the /r/ProgrammingLanguages overview:

This community is dedicated to the theory, design and implementation of programming languages.

Be nice to each other. Flame wars and rants are not welcomed. Please also put some effort into your post.

This isn't the right place to ask questions such as "What language should I use for X", "what language should I learn", and "what's your favorite language". Such questions should be posted in /c/learn_programming or /c/programming.

This is the right place for posts like the following:

See /r/ProgrammingLanguages for specific examples

Related online communities

founded 2 years ago
MODERATORS
1
 
 

Seed7 is a general purpose programming language designed by Thomas Mertes. It is a higher level language compared to Ada, C/C++ and Java. The Seed7 interpreter and the example programs are open-source software. There is also an open-source Seed7 compiler. The compiler translates Seed7 programs to C programs which are subsequently compiled to machine code.

In Seed7 new statements and operators can be declared easily. Functions with type results and type parameters are more elegant than a template or generics concept. Object orientation is used where it brings advantages and not in places where other solutions are more obvious. Seed7 contains several concepts from Pascal, Ada, C, C++ and Java.


The author posted on Reddit; quoting in part:

Seed7 is based on ideas from my diploma and doctoral theses about an extensible programming language (1984 and 1986). In 1989 development began on an interpreter and in 2005 the project was released as open source. Since then it is improved on a regular basis.

Seed7 is about readability, portability, performance and memory safety. There is an automatic memory management, but there is no garbage collection process, that interrupts normal processing. The templates and generics of Seed7 don't need special syntax. They are just normal functions, which are executed at compile-time.

Seed7 is an extensible programming language. The syntax and semantics of statements (and abstract data types, etc.) is defined in libraries. The whole language is defined in the library "seed7_05.s7i". You can extend the language syntactically and semantically (introduce new loops, etc.). In other languages the syntax and semantics of the language is hard-coded in the compiler.

Seed7 checks for integer overflow. You either get the correct result or an OVERFLOW_ERROR is raised. Unlike many JVM based languages Seed7 compiles to machine code ahead of time (GRAAL works ahead of time but it struggles with reflection). Unlike many systems languages (except Rust) Seed7 is a memory safe language.

Some programs written in Seed7 are:

  • make7: a make utility.
  • bas7: a BASIC interpreter.
  • pv7: a Picture Viewer for BMP, GIF, ICO, JPEG, PBM, PGM, PNG, PPM and TIFF files.
  • tar7: a tar archiving utility.
  • ftp7: an FTP Internet file transfer program.
  • comanche: a simple web server for static HTML pages and CGI programs.

Code Example

# Print a Fahrenheit-Celsius table with floating point numbers.

$ include "seed7_05.s7i";  # This must be included first.
  include "float.s7i";     # Subsequent includes do not need a $.

const proc: main is func
  local
    const integer: lower is 0;
    const integer: upper is 300;
    const integer: increment is 20;
    var integer: fahr is 0;
    var float: celsius is 0.0;
  begin
    for fahr range lower to upper step increment do
      celsius := float(5 * (fahr - 32)) / 9.0;
      writeln(fahr lpad 3 <& " " <& celsius digits 2 lpad 6);
    end for;
  end func;
2
 
 

Lean is a theorem prover and programming language that enables correct, maintainable, and formally verified code

/-- A prime is a number larger than 1 with no trivial divisors -/
def IsPrime (n : Nat) := 1 < n ∧ ∀ k, 1 < k → k < n → ¬ k ∣ n
-- 'Grind' efficiently manages complex pattern matching and
-- case analysis beyond standard tactics.
example (x : Nat) : 0 < match x with
  | 0   => 1
  | n+1 => x + n := by
  grind
-- Automatically solves systems of linear inequalities.
example (x y : Int) :
    27 ≤ 11*x + 13*y → 11*x + 13*y ≤ 45
    → -10 ≤ 7*x - 9*y → 7*x - 9*y > 4 := by
  grind

Does anyone have experience with Lean? Can it be useful for implementing algorithms or logic beyond mathematical proofs, for software libs?

3
 
 

Hare’s boringness is a feature, not a bug. Our goal is not to make programming exciting again, but to make it easy to write simple, obvious programs which are optimized for reliability and longevity. An exciting programming language cannot meet that goal as effectively as Hare does. We have instead sought out the smallest and simplest language design which accommodates these goals. Because we have relatively few features, Hare programs tend to converge upon the single obvious way of solving their problems with the tools at their disposal.

4
5
 
 

I am quite nervous while asking this question, but let's say one wants to create a language.

What materials & tools one could use to get started on this path of madness ??

EDIT: I wanted to create an alternative to Javascript😂 with a syntax similar to Bash

6
7
 
 

Examples from the README

example 1

[
  { "let": { "name": "JSON", "times": 3 } },
  {
    "for": {
      "var": "i",
      "from": 1,
      "to": "times",
      "do": [
        { "print": { "add": ["Hello ", "name"] } }
      ]
    }
  }
]

example 2

[
  { "import": "system.jpl" },
  { "print": { "call": { "now": [] } } },
  { "print": { "call": { "osName": [] } } },
  { "print": { "call": { "cpuCount": [] } } },
  { "let": { "a": 9, "b": 4, "name": "JPL" } },
  { "print": { "add": ["\"a + b = \"", { "add": ["a", "b"] }] } },
  { "print": { "mul": ["a", "b"] } },
  { "print": { "div": ["a", "b"] } },
  { "print": { "mod": ["a", "b"] } },
  { "print": { "&": [6, 3] } },
  { "print": { "||": [false, true] } },
  { "print": { "gt": ["a", "b"] } },
  { "def": { "sq": { "params": ["x"], "body": [{ "return": { "mul": ["x", "x"] } }] } } },
  { "print": { "call": { "sq": [5] } } },
  { "def": { "greet": { "params": ["who"], "body": [{ "return": { "add": ["\"Hi, \"", "who"] } }] } } },
  { "print": { "call": { "greet": ["\"JSON Fan\""] } } },
  { "if": { "cond": { "<": ["b", "a"] }, "then": { "print": "\"b < a 👍\"" }, "else": { "print": "\"b >= a 🤔\"" } } },
  { "for": { "var": "i", "from": 1, "to": 3, "step": 1, "do": [ { "print": { "call": { "sq": ["i"] } } } ] } },
  { "print": "\"All features in one! 🎉\"" }
]

example 3

[
// 🚀 Welcome to JPL — JSON Programming Language!

// Import system utilities for fun stuff
{ "import": "system.jpl" },

// Print system info
{ "print": { "call": { "now": [] } } },
{ "print": { "call": { "osName": [] } } },
{ "print": { "call": { "cpuCount": [] } } },

// Define a math function to square a number
{
  "def": {
    "square": {
      "params": ["x"],
      "body": [
        { "return": { "mul": ["x", "x"] } }
      ]
    }
  }
},

// Greet a user
{
  "def": {
    "greet": {
      "params": ["name"],
      "body": [
        { "return": { "add": ["Hello, ", "name"] } }
      ]
    }
  }
},

// Declare variables
{ "let": { "a": 7, "user": "Kapil" } },

// Use greet function and print
{ "print": { "call": { "greet": ["user"] } } },

// Conditional message
{
  "if": {
    "cond": { ">": ["a", 5] },
    "then": { "print": "a is greater than 5" },
    "else": { "print": "a is 5 or less" }
  }
},

// Loop with break and continue
{
  "for": {
    "var": "i",
    "from": 1,
    "to": 10,
    "step": 1,
    "do": [
      { "if": { "cond": { "eq": ["i", 3] }, "then": { "continue": true } } },
      { "if": { "cond": { "gt": ["i", 7] }, "then": { "break": true } } },
      { "print": { "call": { "square": ["i"] } } }
    ]
  }
},

// Fun ending message
{ "print": "🎉 Done with curly braces and JSON fun!" }
]

8
9
10
11
 
 

(I'm not the author or affiliated with the project)

As someone who does arduino work, and occasionally feels the need to just slap something together with dynamic arrays, hashmaps, etc, this seems like a really nice language.

12
13
14
 
 

You can only use shell in Makefiles, right? Wrong! Here's how to use python or javascript or sql or whatever in Makefiles! (please don't do this)

15
 
 

A small scripting language.

  • Dino aims to look like C language
  • High-Level scripting object-oriented language:
    • Multi-precision integers
    • Heterogeneous extensible arrays, array slices
    • Associative tables with possibility to delete elements
    • Powerful and safe class composition operation for (multiple) inheritance and traits description
    • First class functions, classes, and fibers with closures, anonymous functions, classes, fibers
    • Exception handling
    • Concurrency
    • Pattern matching
    • Unicode 8 support

Developed ~32 years ago and revised a few times, last major revision ~9 years ago.

16
 
 

cross-posted from: https://lemmy.world/post/30361372

Hi all,

I don't know where would be the best place to post this, but I wanted some people's feedback on a DSL that I wrote for network analysis.

I am using nom for writing the lexer and parser, then using abi_stable crate for data types so that you can write plugins to the language and load them dynamically as well.

This language is made to work by loading a tree graph (network) and then call a bunch of node or network functions that work on it. There are different ways you can run functions, and use node/network attributes.

I am mostly self-taught, so it took a lot of years to get to a level where I could write something like this. I am learning a lot and having a lot of fun in the process, but I want this to develop into something that can have a practical usefulness to people. Since I am in the field of hydrology, I am making it with river networks in the mind.

To try it out, you can either download the executables for windows from the releases page, or you can compile it using cargo (for all OS; except android where GUI won't work, CLI will work in termux). I have some basic examples in the Learn By Examples section of the User Guide that you can follow.

Please let me know if you can't compile/use it as well. I have tried to make sure it has required instructions, but I could have missed something.

17
2
Iron Spring PL/I Compiler (www.iron-spring.com)
submitted 2 months ago* (last edited 2 months ago) by armchair_progamer@programming.dev to c/programming_languages@programming.dev
 
 

PL/I (pronounced "Programming Language 1") is a programming language that first appeared in 1964. It resembles BASIC and COBOL. This site is bare-bones and uses tables for layout (common before CSS).

However, this compiler is relatively new and still being maintained. v1.4.0 was released yesterday (it added support for array expressions), v1.0 was released in 2023, and development started in 2007.

18
 
 

image

I wanted to make a programming language that resembled magical circles. This is more like a way to write PostScript that looks like a magical circle, but I will refer to it as Mystical in this document.

Related: https://programming.dev/post/28438809

19
 
 

(I am not the author)

Seems interesting for those who do symbolic computing

20
21
 
 

ArkScript is an interpreted/compiled language since it runs on a VM. For a long time, runtime error messages looked like garbage, presenting the user with an error string like "type error: expected Number got Nil" and some internal VM info (instruction, page, and stack pointers). Then, you had to guess where the error occurred.

I have wondered for a long time how that could be improved, and I only started working on that a few weeks ago. This post is about how I added source tracking to the generated bytecode, to enhance my error messages.

22
 
 

A design that subsumes the various syntactic forms of

  • if statements/expressions
  • switch on values
  • match on patterns and pattern guards
  • if-let constructs

and scales from simple one-liners to complex pattern matches.

23
 
 

Rivulet is a programming language of flowing strands, written in semigraphic characters. A strand is not pictographic: its flow does not simulate computation. There are four kinds of strands, each with their own symbolism and grammatical rules. Together, they form glyphs, tightly-packed blocks of code whose strands execute together.

Here is a complete Fibonacci program:

   ╵──╮───╮╭─    ╵╵╭────────╮
    ╰─╯╰──╯│       ╰─╶ ╶╮╶╮╶╯
   ╰─────╮ │      ╭─────╯ ╰─────╮
         ╰─╯ ╷    ╰───       ───╯╷

   ╵╵─╮  ╭─╮     ╭──       ╵╵╰─╮  ──╮──╮
      ╰─╮│ ╰─╯ ╵╵╰─╯╶╮       ╴─╯  ╭─╯╭─╯
      ╰─╯╰─ ╰──╯╰────╯       ╭╴ ╵╶╯ ╶╯╶╮
        ╭─╮ ╭╴               │  ╰──────╯
        │ │ │                ╰─╮       ╭─╮
      │ │ ╰─╯                  │     │   │
      ╰─╯            ╷         ╰──── ╰───╯╷

   ╵╵ ╭──  ──╮  ╭─╮         ╵╰─╮
      ╰─╮  ╭─╯╭─╯ │          ╴─╯
       ╶╯╵╶╯  │ ╷╶╯          ╭─╮
     ╭─╮ ╰────╯ │   ╭─╮        │
     │ ╰────╮ ╭─╯ ╭╴│ │      ╭─╯
     ╰────╮ │ │ │ │ │ │      │
     ╭────╯ │ │ ╰─╯ │ ╷      ╰─╷
     ╰────╮ │ ╰─────╯ │
          │ ╰─────────╯╷

24
 
 

We’ve just made Marksafe even more intuitive and concise with shorthand syntax and delimiter escaping!

New Shorthand Syntax – Write cleaner markup with:
👉 [uli]item1;;item2;;item3[/uli] instead of [ul][li]item1[/li][li]item2[/li][li]item3[/li][/ul]
👉 [bq]A blockquote example[/bq] instead of [blockquote]A blockquote example[/blockquote]

Delimiter Escaping – Need to use ;;, ,,, or other special characters inside content or attributes? Just escape them with \:
👉 [a]href=https://example.com,,Click here to see \,,escaped commas[/a]

Marksafe keeps all the flexibility of HTML while staying lightweight and readable—perfect for devs who need powerful, secure, and extensible rich text formatting.

🔗 Check it out here: https://github.com/mksunny1/marksafe
💬 Docs & API: https://github.com/mksunny1/marksafe/blob/main/docs/classes/Marksafe.md
💖 Support & Contribute: https://github.com/sponsors/mksunny1

Try it out and let me know what you think!

25
 
 

Reminds me a bit of prolog with the query system

view more: next ›