Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Domy is a simple boolean-centric language.
In terms of language design, Domy shares features from both imperative and functional programming paradigms, supporting functions as first class citizens and state.
Core Ideas:
Domy runs as a command line application on node.js (REPL and File Path Mode both available).
Usage: domy <filePath.do>?
Requires npm or yarn:
npm i -g domy-lang
yarn global add domy-lang
The Lexer is inspired by Bob Nystrom's Crafting Interpreters Book chapter on Scanning.
The Parser is handmade and based on the grammar defined below, as I could not understand the TDOP Parser enough to implement it myself.
The Interpreter is a simple handmade tree walker that runs the generated parse trees.
program
: statement*
;
statement
: expression
| 'my' id '=' statement
| id '=' statement
;
expression
: or
| or '==' expression
| or '!=' expression
;
or
: xor
| xor '|' or
;
xor
: and
| and '^' xor
;
and
: not
| not '&' and
;
not
: term
| '!' term
;
term
: true
| false
| break
| continue
| 'return' statement?
| 'do' arg_list block
| 'while' statement block
| id
| id inv_list
| '(' statement ')'
| '(' statement ')' '?' statement ':' statement
| block
;
id
: letter (dash | letter | number)*
;
arg_list
: '(' (id ',')* id? ')'
;
inv_list
: '(' (inv ',')* inv? ')'
;
inv
: statement
;
block
: '{' statement* '}'
;
letter
: [a-z] | [A-Z]
;
dash
: '-' | '_'
;
number
: [0-9]
;
WS
: [\s\r\n\t] -> skip
| '#' .* '\n' -> skip
;
Ever since I took Principles of Programming Languages in Fall 2018, I have been fascinated with learning about different programming language paradigms
Naturally, the ongoing search piqued my curiosity as to now implement my own language!
I quickly learned how to create a lexer, but when it came to parsing, I had no success regardless of how many articles and tutorials I completed.
My hope is that domy will be my first complete language, regardless of how esoteric the nature and value of it is.
Also, I had a crazy line of thought where everything returns a boolean value with no language constructs, but some of the constructs were still useful for my own sanity and for turing completeness.
The language is now runnable, although there is no complete test suite as there is no language specification (so I expect tremendous amounts of undefined behavior).
It took me a long time to implement the keywords return, break, and continue, almost to the point of removing this element.
However, I realized my language would then only be boolean logic, which is pointless.
There is a great sense of relief now that I finished, as my previous languages were not even remotely close to being finished.
This journey felt like it took a lifetime although it really has been less than a month.
I am glad I am not burnt out towards the topic of programming languages and have finally reached the first milestone!
My next steps are to consider compilation, although I will first take a break to gather any new ideas and study up.
Fun Fact: Domy got its name from the two language constructs do
and my
. Although they are not the only reserved words anymore, they were the inspiration for the name of the language.
FAQs
Do My Language
We found that domy-lang demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.