Strict Programming Language

Strict Programming Language

  • Docs
  • API
  • Blog

›All Blog Posts

All Blog Posts

  • March 2023 Mutable
  • January 2023 Multi Line Text Expressions and Introducing New Lines in Strict
  • January 2023 Namings in Strict
  • December 2022 Traits and Components
  • November 2022 Multi Line List Expressions
  • November 2022 Strict Base and Example folders moved to separate repository
  • October 2022 Shunting Yard
  • September 2022 For loops
  • September 2022 Details about Mutability in Strict
  • July 2022 Introduction To Generics In Strict
  • May 2021 Strict Newbie Experiences
  • June 2021 Slow Progress
  • May 2021 BNF Grammar
  • May 2021 Next Steps
  • Jul 2020 Getting Back Into It
  • Jul 2020 Optimizing FindType
  • Jul 2020 Package Loading
  • Jun 2020 Parsing Methods
  • Jun 2020 As Simple As Possible
  • Jun 2020 Back to blogging
  • May 2020 Slow and not steady
  • Apr 2020 Sdk going open source
  • Feb 2020 Still work in progress
  • Jan 2020 website is up

May 2021 BNF Grammar

May 18, 2021

Benjamin Nitschke

In todays meeting we discussed the grammar a bit more and we updated our Strict.bnf file, it is still very small, distinct and most importantly not done yet (tm):

file ::= {implement} {import} {member} {method}
implement ::= 'implement' type '\n'
import ::= 'import' namespace '\n'
namespace ::= Name | namespace '.' Name
type ::= Name
member ::= 'has' variable '\n'
variable ::= Name [type]
method ::= methodcall ['returns' type] '\n' [block]
methodcall ::= methodname ['(' parameters ')']
methodname ::= Name | binary | unary | 'from' | 'to'
parameters ::= variable | variable ',' parameters
block ::= {'\t'} {expression '\n'} ['return' expression '\n']
expression ::= 'true' | 'false' | 'from' | 'to' | Number | String |
    expression binary expression | unary expression | [namespace] methodcall |
    'let' Name '=' expression |
    variablereference |
    'if' expression '\n' block '\n' ['else' '\n' block] |
    'for' variablereference 'in' expression 'to' expression '\n' expression
variablereference ::= [namespace] Name
binary ::= '+' | '-' | '*' | '/' | '%' |
    '<' | '<=' | '>' | '>=' |
    'is' | 'is' 'not' | 'and' | 'or'
unary ::= '-' | 'not'

Strict Grammar

Strict is easy to read and write, there is usually only one way to do things and it doesn't need fluff like end of line characters. Blocks are indented and have no start, end or brakets (like in Python). All lines are expressions and have to evaluate to true, otherwise the execution and even compilation stops at this point. Callers can use catch blocks to check for this.

These grammar files are not really used to generate any lexer, parser, tokenizer. They are here for informational purposes and to generate syntax highlighting like for Textmate (.tmLanguage), which can be imported to Visual Studio Code, Textmate, Atom, Ace, Sublime, etc.

  • Strict.bnf (Backus-Naur form)
  • Strict.iro (Iro to create syntax highlighters for modern IDEs)

To generate .tmLanguage (for Visual Studio Code or Textmate) or syntax highlighter files for other IDEs or tools use https://eeyo.io/iro/

Other languages

Strict has lots of similarity with C#, Java, C++, F#, Lisp, Scheme, etc. However Lua and Python are syntax-wise probably the closest because of their simplicity and more simple look.

  • https://www.lua.org/manual/5.1/manual.html
  • https://docs.python.org/3/reference/grammar.html
  • https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure
Recent Posts
  • Other languages
Strict Programming Language
Docs
Getting StartedCoding StyleAPI Reference
Community
Stack OverflowProject ChatTwitter
More
HelpGitHubStar
Copyright © 2023 strict-lang