Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexdremov/ngg
"Never gonna give you up" programming language
https://github.com/alexdremov/ngg
ast compiler education language meme never-gonna-give-you-up programming-language
Last synced: about 3 hours ago
JSON representation
"Never gonna give you up" programming language
- Host: GitHub
- URL: https://github.com/alexdremov/ngg
- Owner: alexdremov
- Created: 2020-12-10T08:19:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-18T08:43:06.000Z (almost 4 years ago)
- Last Synced: 2023-10-25T18:36:44.488Z (about 1 year ago)
- Topics: ast, compiler, education, language, meme, never-gonna-give-you-up, programming-language
- Language: C++
- Homepage:
- Size: 6.78 MB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NGG
**Never Gonna Give** (you up) programming languageLanguage with the power of the legend. Code can be executed on [SPU](https://github.com/AlexRoar/SPUAsm)
# Syntax
[Beautiful PDF](https://github.com/AlexRoar/NGG/raw/main/NGG.pdf)
*Main*
Start ::= {FuncDecl | VarDefStmt}*
*Identifier*
Identifier ::= Identifier[Character {Character | Number}*]
Number ::= Number[Digit+]
Digit ::= "regexp:[0-9]"
Character ::= EngCharacter | '_'
EngCharacter ::= "regexp:[a-zA-Z]"*Function essentials*
FuncDecl ::= FDecl['never gonna'] Identifier
LPA['('] ArgumentsList? RPA[')'] BlockStmt
ArgumentsList ::= Identifier {Comma[','] Identifier}*
CallList ::= rValue {Comma[','] rValue}**Values*
rValue ::= AddSubExpr {(Eq['=='] | Leq['<='] | Geq['>=']
| Neq['!='] | Gr['>']| Le['<']) AddSubExpr}?
AddSubExpr ::= MulDivExpr
{(Plus['+'] | Minus['-']) MulDivExpr}*
MulDivExpr ::= UnaryExpr {(Mul['*'] | Div['/'] | Pow['^']) UnaryExpr}*
UnaryExpr ::= ((Plus['+'] | Minus['-']) PrimaryExpr)
| PrimaryExpr
PrimaryExpr ::= LPA['('] rValue RPA[')']| Input | Number | FuncCall |
Identifier
FuncCall ::= Identifier LPA['('] CallList? RPA[')']*Blocks*
BlockStmt ::= BStart['strangers'] Statement* BEnd['to love']
Statement ::= (VarDef | Print | AssignExpr |
FuncCall) StEnd['bdum']
| ReturnStmt | IfStmt | WhileStmt | BlockStmtAssignExpr ::= Identifier (Assg['='] | AdAssg['+='] |
MiAssg['-=']
| MuAssg['*='] | DiAssg['/=']) rValue
VarDef ::= VDecl['make you'] (Identifier Assg['=']
rValue | Identifier )
VarDefStmt ::= VarDef StEnd['bdum']
Print ::= Print['goodbye'] rValue
Input ::= Input['ask me']*Control Sequences*
IfStmt ::= If['you know the rules']
LPA['('] rValue RPA[')']
BlockStmt {Else['and so do I'] BlockStmt}?
WhileStmt ::= While['run around']
LPA['('] rValue RPA[')'] BlockStmt
ReturnStmt ::= Return['known each other for so long'] rValue
StEnd['bdum']
# Memory management… | global variables | stack memory
| Use | Register |
|:--|:--|
| Bp register | rex |
| Tmp calculations | rax |
| Tmp calculations2 | rbx |# Example
```
never gonna giveYouUp() strangers
goodbye fact(ask me) bdum
to lovenever gonna fact(num) strangers
you know the rules (num <= 1) strangers
known each other for so long 1 bdum
to love and so do i strangers
known each other for so long fact(num - 1) * num bdum
to love
to love
```