PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Semantic Indentation

Semantic Indentation

Semantic Indentation is a feature.

With this pattern, programmers indent their code blocks with whitespace instead of using braces, brackets, or other visible characters.


Languages without Semantic Indentation include Java, JavaScript, C, C++, HTML, SQL, PHP, XML, Perl, MATLAB, C#, Ruby, Fortran, MySQL, R, JSON, Go, COBOL, Swift, Scala, CSS, Rust, PostgreSQL, Pascal, Ada, Lua, TypeScript, ARM, SAS, Prolog, Clojure, Kotlin, PowerShell, Elixir, Erlang, Mathematica, Visual Basic, Objective-C, Julia, CUDA, Modula-2, Dart, Tcl, Scheme, Regular Expressions, Reason, Bash, BASIC, Crystal, ActionScript, awk, Delphi, Verilog, Modula-3, Solidity, OCaml, Eiffel, Smalltalk, D, Maple, Sage, Yacc, GraphQL, Groovy, LaTeX, VHDL, Racket, Smali, Common Lisp, APL, LLVM IR, PostScript, Red, OpenCL, Chapel, Haxe, XQuery, Nginx, LFE, SPSS, PureBasic, Forth, Rexx, Visual Basic .NET, CIL, ANTLR, SVG, Tex, Oz, fish, Idris, Applescript, Oberon, Simula, Logo, VBScript, Lasso, V, PicoLisp, AMPL, ABAP, Protocol Buffers, BCPL, Standard ML, Processing, Nearley, idyll, REBOL, MoonScript, Terra, FLUX, Hack, DOT, Jison, Rust MIR, Dylan, Fantom, PL/SQL, Limbo, Agda, Frege, Ballerina, ColdFusion, EuLisp, Monkey, AutoIt, GNU Octave, MUMPS, Emacs Lisp, Zephir, x86 Assembly, Hy, TOML, Squirrel, Vala, X10, PL/I, Icon, Turing, Scilab, Flow, Click, NewLisp, Nextflow, QML, Java Bytecode, xBase, EDN, IDL, Mercury, JSON5, J, Ceylon, Stata, PostCSS, Io, ALGOL 60, Clean, SuperCollider, SystemVerilog, Object Pascal, AGC, Opa, SNOBOL, CLIPS, HCL, TLA, Bison, API Blueprint, odin, Dafny, Ini, Self, Isabelle, Wren, B, Pike, ATS, Deno, Factor, NetLogo, S-algol, Csound, Lex, Xojo, Dhall, Perl 6, AutoHotkey, Alloy, E, Modelica, PEG.js, halide, Objective-J, M4, Clipper, Wolfram Language, UrWeb, Datalog, Pig Latin, Gambas, AspectJ, Seed7, Befunge, JFlex, PowerBuilder, YASnippet, XS, FreeBASIC, starlark, Transact-SQL, DTrace, unison, PRQL, Classroom Object Oriented Language, NSIS, SETL, XBase++, Maxima, Falcon, KaTeX, Augmented Backus-Naur Form, JCL, Netwide Assembler, Dc, SourcePawn, CWL, True BASIC, Bluespec, WxBasic, Fennel, mlir, Ren'Py, Closure Templates, WDL, Ion, K, Sather, EBNF, Java Properties, Cue, CIL, LiveCode, Oberon-2, datascript, Koka, Xtend, eC, Eve, Ragel, Fortress, Ron, Unicon, HOPE, carp, PARI/GP, Ring, XSLT, Cg, PAWN, SIL, Hjson, OpenVera, Felix, Taichi, P4, BETA, Action!, PL/M, Expect, UNLAMBDA, Guile, Slope, MQL5, Angelscript, LilyPond, JAI, Volt, IGOR Pro, QB64, NCAR Command Language, LPC, Filebench WML, NetLinx, Jule, beads-lang, mgmt, Dockerfile, KiXtart, ThinBasic, MiniD, ARexx, CLOS, Euphoria, LotusScript, Yoix, OpenSCAD, blockml, JADE, Concise Encoding, Mu, S3, LookML, Mask, Apex, Logica, Whiley, ArkScript, DM, Lily, Turbo Basic, Linden Scripting Language, GDScript, Joy, Eclipse Command Language, SugarSS, Ch, PIC, ShaderLab, Tea, WebIDL, storyscript, Fancy, FutureBASIC, StarOffice Basic, Praat Script, Harbour, Observable, zephyr-asdl, PowerBASIC, POV-Ray SDL, carth, CartoCSS, COMPONENT PASCAL, RenderScript, Jasmin, Literate Agda, Game Maker Language, Refal, ECL, Golo, Edje Data Collection, Objective C++, Alpine Abuild, Slice, mun-lang, Script.NET, OX, SimCode, omega, Mirah, BLISS, CLIST, Vigil, Not Quite C, GAP, ActiveVFP, spry, GCC Machine Description, Strips, Spatial, Pan, Fibonacci, Brightscript, Cycript, winxed, Raku, Cach茅 Basic, MVEL, SMT, Ezhil, Cell, Logtalk, SRecode Template, Creative Basic, NetRexx, MAXScript, LoomScript, dex, Mary, Type Language, Opal, Not eXactly C, Treelang, Arden syntax, MOO, VHDL-AMS, Bel, XBLite, c3, Neko, lispyscript, Operational Control Language, Maya Embedded Language, Fable, FML, HiveQL, Lingo, Handel-C, Logos, BitBake, S-PLUS, NestedText, Guix Workflow Language, KRL, MACRO-10, turnstile, Gentoo Ebuild, OCL, Vale, spiral, neut, tht, Plus, Xbasic, Module Management System, RELAX NG, NS Basic, Rc, JSON with Comments, monte, Rescript, dslx, HAGGIS, CIR, Grammatical Framework, gentee, Simple Actor Language System and Architecture, Parser 3, Tuple space, CFScript, Frink, Gherkin, flagship, Parrot BASIC, PowerQuery M, Yet Another Scripting Language, Orc, Recfiles, ddfql, Hocon, Embedded Crystal, neeilang, hilvl, txr, Zimpl, Ren, holyc, Adventure Game Studio Script, Nymph, C shell, Charity, Jsonnet, Mouse, Language Server Index Format, epsilon, GraphQL Schema Definition Language, ArchieML, Soy, silk, manool, z80, Judoscript, verifpal, Finite State Language, StruQL, Yedalog, Fj枚lnir, Claro, Structured Query Reporter, owen-lang, popr, kai, fizz, JSL, ldpl, OEM, Lite-C, Project Mentat, tremor-query, taf, atomese, Manchester syntax, dedukti, Reactive Plan Language, Heron, Action Code Script, dlvm, XPL0, rosette-lang, xxl, Bla, ISETL, ca65 Assembly, rbs, Pnuts, False, Portable Bit Map Format, Wart, stella, ctalk-lang, OptimJ, ProbeVue, Plot, Netpbm grayscale image format, wescheme, JCOF, bioscript, ppm-format, sora, SubX, blz, lain, luau, rbscript, WebAssembly Text Format

Languages with Semantic Indentation include Python, Haskell, F#, CoffeeScript, Elm, YAML, Nim, Markdown, PureScript, HAML, Org, Occam, Makefile, Boo, Nemerle, Sass, Inform, reStructuredText, wisp, LiveScript, Miranda, Genie, ABC, Stylus, Argdown, Imba, Curry, Spin, Literate CoffeeScript, Aldor, Cobra, XL, mckeeman-form, SCSS, ISWIM, Sheep, Quaint, I-expressions, PROMAL, Z, Cirru, p4p, Tree Notation, BuddyScript, net-format, ELFE, bml, Sweet Expressions, Ohayo, Indental, CSL, Note, Space, converge, Ordered graph data language, MADCAP VI, MADCAP

Example from Python:
class Person (object): def __init__(self, name): self.name = name
Example from PureScript:
-- https://github.com/purescript/documentation/blob/master/language/Syntax.md -- Syntax is whitespace sensitive. The general rule of thumb is that declarations which span multiple lines should be indented past the column on which they were first defined on their subsequent lines. foo = bar + baz
Example from Sheep:
define pythtree ax:real ay:real bx:real by:real depth:int do cx = ax-ay+by end
Example from Z:
defun message msg do print : Here's a message print msg print : End of message.
Example from Cirru:
print + 1 2 , 11
Example from Tree Notation:
example title Tree Notation
Example from Note, Space:
settings title Note
regular-expressions-syntax-sugar-feature.html 路 semantic-indentation-feature.html 路 single-dispatch-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 31 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com