Toy weekend project: make a parser-parser!
This takes in a grammar given in Bakus-Naur Form (BNF),
and a program that was written in the provided grammar,
and produces an image of Syntax Tree using graphviz
.
References:
Since Chrome apps are now being deprecated. Download postman from https://dl.pstmn.io/download/latest/linux
Although I highly recommend using a snap
sudo snap install postman
tar -xzf Postman-linux-x64-5.3.2.tar.gz
public static class DataHelper | |
{ | |
public static async Task ManageDataAsync(IServiceProvider svcProvider) | |
{ | |
//Service: An instance of db context | |
var dbContextSvc = svcProvider.GetRequiredService<ApplicationDbContext>(); | |
//Migration: This is the programmatic equivalent to Update-Database | |
await dbContextSvc.Database.MigrateAsync(); |
public static class ConnectionHelper | |
{ | |
public static string GetConnectionString(IConfiguration configuration) | |
{ | |
var connectionString = configuration.GetConnectionString("DefaultConnection"); | |
var databaseUrl = Environment.GetEnvironmentVariable("DATABASE_URL"); | |
return string.IsNullOrEmpty(databaseUrl) ? connectionString : BuildConnectionString(databaseUrl); | |
} | |
//build the connection string from the environment. i.e. Heroku |
//program.cs | |
var app = builder.Build(); | |
var scope = app.Services.CreateScope(); | |
await DataHelper.ManageDataAsync(scope.ServiceProvider); |
root = true | |
# C# files | |
[*.cs] | |
#### Core EditorConfig Options #### | |
# Indentation and spacing | |
indent_size = 4 | |
indent_style = space |