Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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
The npm package domy-lang receives a total of 4 weekly downloads. As such, domy-lang popularity was classified as not popular.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.