stdlib-js / google-summer-of-code

Google Summer of Code resources.
https://github.com/stdlib-js/stdlib
26 stars 7 forks source link

[RFC]: generate web documentation from JSDoc comments #59

Closed USERSATOSHI closed 5 months ago

USERSATOSHI commented 6 months ago

Full name

Tushar Bharti

University status

Yes

University name

Indian Institute of Information Technology, Bhagalpur

University program

Computer Science and Engineering

Expected graduation

31-5-2025

Short biography

Hello, My name is Tushar Bharti, A 3rd year undergrad student at IIIT Bhagalpur pursuing Computer Science and Engineering. I am a passionate developer with passion in software development , having proficiency in C/C++, JavaScript/TypeScript, NodeJS as well as experience in full stack development via academic and internship projects.

My skills span across various domain such as full stack development, application development, package/library development as well as deep understanding in various programming languages. I also compete regularly in competitive programming contests on Codeforces having rating of 1414 ( specialist ) which enhances my problem solving abilities and performant implementation of problems.

My general interests lies in testing out new frameworks as well as languages, such as trying out bunJS, rust, zig etc as well as frameworks like elysiaJS , svelte, astro etc. I also keep have huge interest towards parsers in compiler design, OOP and computer networks. Compiler design allowed me to write parsers for various data extraction tasks from code using code patterns , whereas I used OOP as a general way to implement structures and reusable instances and computer networks for implementing various protocols, such as udp , tcp etc

Timezone

IST ( UTC +5:30 )

Contact details

email:tushar.bharti.003@gmail.com,github:usersatoshi

Platform

Linux

Editor

I rely on two main code editors: Visual Studio Code (VSCode) and Neovim. Each one has its own perks, so I pick the one that fits the task.

When it comes to activities such as coding contests or conducting tool and integration tests, I find Visual Studio Code (VSCode) to be my preferred choice. It has a lot of extensions created by users for various integrations like language tools such as bunjs toolings as well a companion judge which i majorly use during competitive programming contests.

When going through larger projects or creating personal projects, I prefer to use Neovim as my primary editor. Its fast boot up time and fast navigation system due to fuzzy search makes going through files quick and less time consuming. Additionally, Neovim's has minimal battery consumption on my laptop, which is particularly great during battery use and traveling.

Having both editors allows me to switch between them as the situation arises.

Programming experience

In my programming journey, I've explored various domains, including competitive programming, software development, and web development.

I'm actively engaged in competitive programming, with a rating of 1414 (Specialist) on Codeforces, where I primarily use C++.

Aside competitive programming, I've delved into web development with Node.js and TypeScript. Some of my favorite projects include:

In addition to these projects, I've developed utilities tools like ytdn, a minimalist YouTube downloader CLI using Node.js.

Furthermore, I've gained practical experience through internships, where I contributed to a full-stack SaaS website with a web builder. Additionally, I've led academic projects, including creating official websites for my college fest and managing backend systems for my college's student academic portal.

JavaScript experience

In Javascript, I have gained experience via academic projects , Open source communities and writing applications. I have developed interactive web applications, backend using runtimes like nodejs and bunjs. I'm proficient in concepts like such as promises , async/await, closures, oops , es6 features, etc. This enabled me to write readable and user-friendly code with documents as a guide for others while trying to keep it as performant as possible. Furthermore, I have also experience using popular frameworks such as ReactJs, Astro, as well as runtimes such as NodeJs and BunJs.

My favorite features in Javascript are Promise.all and TypedArrays.

My least favorite features in Javascript are Type Coercion and this.

Node.js experience

In NodeJS, I have gained experiences by

C/Fortran experience

tho I primarily use C++ as my low level system language, I have solid foundation in C as this was the primary language that has been taught in our college along side with various projects ranging from implementing data structures and algorithms of C++ in C, to managements systems via command line , to embedded developmentn in 8051 micro-controller. thus giving me ample knowledge and understanding on it.

Interest in stdlib

stdlib (/ˈstændərd lɪb/ "standard lib") is a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing applications. The library provides a collection of robust, high performance libraries for mathematics, statistics, data processing, streams, and more and includes many of the utilities you would expect from a standard library.

This encompasses 2 of my favorites: Mathematics and Javascript development. One of my favorite features is the wide range of implementations of mathematical functions available in Stdlib. These functions not only provide essential utilities for mathematical operations but also demonstrate the library's dedication to cover major mathematical / numerical computation programs as well as utilities functions

Version control

Yes

Contributions to stdlib

As of right now, I have 2 contributions in stdlib , one merged and one unmerged:

merged:

unmerged:

Goals

stdlib relies heavily on JSDoc comments to document its source code. Currently, the project has only rudimentary support for generating HTML docs from those comments. The goal of this idea would be to

JSDoc comments are oriented toward JavaScript source files; however, stdlib also uses similar documentation practices for documenting C source files and make files. A possible extension to the in-house JSDoc parser would be to support these other source file types. As those file types may require separate AST parsers, supporting other file types is likely to require writing separate comment parsers for each source type.

Why this project?

generate web documentation from JSDoc comments requires in-depth knowledge in creating a lexical parser as well as an syntax parser which then would be used to generate HTML + CSS files for web documentation. these parser would require breaking down jsDoc comments into useful tokens which then would be converted into an Abstract Syntax Tree ( AST ).

As I have a background in Computer Science and coursework in Compiler Design and experience in web development, this project excites me to create a working parser which constitute the frontend part of compiler design and then use the generated AST to create static website documentation which would test both my knowledge in compiler design as well as experience in web development.

Qualifications

i have solid experience in Javascript, NodeJS, C/C++ as well as foundations required for software development as well as adaptability to learn and understand codebase quickly with quick initial helps as guides. This allows me to understand and write programs efficiently.

As a 3rd year undergraduate at IIIT Bhagalpur pursuing computer science, I have coursework in compiler design as well as various academic and internship projects in web development which makes me well suited for this project.

Being my favorite subject , Compiler Design allowed me to write different parsers ranging from

Plus handling web projects for my college such as Student Academic Portal , Techno-cultural fest's official site, etc as well as internships allowed me having deep knowledge in web development.

Also having experience through competitive programming via Codeforces as well as collaborative projects allows me to approach this project in a way which tries to improve the efficiency of the parser but also keeps the code human-readable to allow for easier and manageable maintenance and up-gradation.

Prior art

Here are the implementation of a parser for JsDocs and its relatives which I found during research:

these resources should be enough to implement an in house jsDoc parser as well as document generation from that parser

Commitment

1 May - 26 May -> Bonding Period 27 May - 7 July -> 35 hours/week ( 35 6 ) 8 July - 17 August -> 23 hours/week ( 23 6 ) Total = 210 + 138 = 348 hours

Schedule

Assuming a 12 week schedule,

Related issues

[Idea]: generate web documentation from JSDoc comments

Checklist

Pranavchiku commented 6 months ago

Hey @USERSATOSHI, this proposal is good. Impressed by your skills, I have few suggestions

USERSATOSHI commented 6 months ago

Hey @USERSATOSHI, this proposal is good. Impressed by your skills, I have few suggestions

* You may brief about what will be the grammar for your parser, provide an example, develop a small parser that for example works for a particular package ( say C example documentation ), describe it in your proposal.

* Currently, the proposal lacks "how" & "what" are you going to do. Adding this will make it great.

Hi @Pranavchiku , So should i mention an actual snippet or an example for each

like for typedef parser


TypeDefParse("Array<string>")
/* returns { 
  original: "Array<string>", 
  parsed: "Array<#Child_0#>",
  type: "Generic",
  name: "Array",
  isCustom: false,
  link: "link to mdn array",
  body: [{
    original: "string",
    parsed: "string",
    type: "primitive",
    name: "string",
    isCustom: false,
    body: [],
    link: "link to mdn string"
 }]
}
*/

TypeDefParse("(string | number)[]")
/* returns {
   original: "(string | number)[]",
   parsed: "(#CHILD_0# | #CHILD_1#)[]",
   type: "Generic",
   name: "Array",
   isCustom: false,
   link: "link to mdn array",
   body: [{
       original: "string",
       parsed: "string",
       type: "primitive",
       name: "string",
       isCustom: false,
       body: [],
       link: "link to mdn string",
   },{
       original: "number",
       parsed: "number",
       type: "primitive",
       name: "number",
       isCustom: false,
       body: [],
       link: "link to mdn number",
   }]
}
*/
Pranavchiku commented 6 months ago

Yes, take a package, mention every small requirement in detail.

USERSATOSHI commented 6 months ago

ok got it!

USERSATOSHI commented 6 months ago

@Pranavchiku I have updated the the schedule can you review it back in your free time

kgryte commented 6 months ago

Thanks, @USERSATOSHI, for sharing a draft of your proposal. A few comments:

  1. The parser should not be extended beyond JSDoc and JSDoc-like comments. So, e.g., the project should not, e.g., resolve the list of module dependencies or do anything with file "sections" (i.e., // MAIN //, etc).
  2. We heavily use JSDoc comments in three source file types: 1) JavaScript, 2) C, and 3) Makefile. You address the first two. I suggest including the third and swapping in for the "extensions" you mention in weeks 7&8.
  3. Another reference implementation it may be worth investigating is how ESLint and its associated plugins handle JSDoc parsing. And IIRC, another parser is doctrine, but this has been archived: https://github.com/eslint/doctrine. You may want to find out what is used more recently.
USERSATOSHI commented 6 months ago

@kgryte Hi! Thank you for reviewing, about the extension , we can cut off most of the thing but dependencies can be left in so that we can make a reference link on require like you suggested on the original idea issue:

Generated JSDoc documentation is likely to be static, but one can envision possible extension to supporting inter-package linking (e.g., require statements would be transformed into links). Link

We heavily use JSDoc comments in three source file types: 1) JavaScript, 2) C, and 3) Makefile. You address the first two. I suggest including the third and swapping in for the "extensions" you mention in weeks 7&8.

I will update the week 7 & 8 to include MakeFile

nother reference implementation it may be worth investigating is how ESLint and its associated plugins handle JSDoc parsing. And IIRC, another parser is doctrine, but this has been archived: https://github.com/eslint/doctrine. You may want to find out what is used more recently.

Thank you for the reference, I will check out eslint and doctrine as you mentioned and do some investigation from here too