136 research outputs found

    flap: A Deterministic Parser with Fused Lexing

    Full text link
    Lexers and parsers are typically defined separately and connected by a token stream. This separate definition is important for modularity and reduces the potential for parsing ambiguity. However, materializing tokens as data structures and case-switching on tokens comes with a cost. We show how to fuse separately-defined lexers and parsers, drastically improving performance without compromising modularity or increasing ambiguity. We propose a deterministic variant of Greibach Normal Form that ensures deterministic parsing with a single token of lookahead and makes fusion strikingly simple, and prove that normalizing context free expressions into the deterministic normal form is semantics-preserving. Our staged parser combinator library, flap, provides a standard interface, but generates specialized token-free code that runs two to six times faster than ocamlyacc on a range of benchmarks.Comment: PLDI 2023 with appendi

    Row and Bounded Polymorphism via Disjoint Polymorphism

    Get PDF
    Polymorphism and subtyping are important features in mainstream OO languages. The most common way to integrate the two is via ?_{< :} style bounded quantification. A closely related mechanism is row polymorphism, which provides an alternative to subtyping, while still enabling many of the same applications. Yet another approach is to have type systems with intersection types and polymorphism. A recent addition to this design space are calculi with disjoint intersection types and disjoint polymorphism. With all these alternatives it is natural to wonder how they are related. This paper provides an answer to this question. We show that disjoint polymorphism can recover forms of both row polymorphism and bounded polymorphism, while retaining key desirable properties, such as type-safety and decidability. Furthermore, we identify the extra power of disjoint polymorphism which enables additional features that cannot be easily encoded in calculi with row polymorphism or bounded quantification alone. Ultimately we expect that our work is useful to inform language designers about the expressive power of those common features, and to simplify implementations and metatheory of feature-rich languages with polymorphism and subtyping

    Development and application of a borehole stress meter in rocks surrounding the roadway, based on optical-fiber sensing technology

    Get PDF
    Stress in rock masses is an important parameter in the design and construction of underground engineering, such as the design and maintenance of mine roadways and the design of mining working faces. It is also a fundamental force causing the deformation and failure of geotechnical engineering excavation. At present, the abutment-pressure monitoring technology of the surrounding rocks of the coal mine roadway in China is not intelligent and systematic and lacks some high-precision sensing instruments and multi-functional monitoring systems. The mechanical model of the rocks surrounding the borehole was constructed by theoretical analysis of problems in the stress monitoring technology for underground rock masses in coal mines. Additionally, the interaction between the surrounding rocks and the borehole stress meter was analyzed. The borehole stress meters for tubular-structure fiber Bragg grating (TS-FBG) and cystic-structure fiber Bragg grating (CS-FBG) were designed by combining the sensing principle and sensing characteristics of fiber Bragg grating, and the performance of the two kinds of fiber Bragg grating borehole stress meters was compared by laboratory test. The track roadway of the 14,301 tested working faces in the Shaqu Coal Mine was taken as an example, and the stress of the rocks surrounding the 14,301-track roadway was monitored in real time by CS-FBG borehole stress meter during the mining of the working face. The following conclusions are drawn from the field application. The rig-site utilization results revealed obvious stress growth and stress peak zones in the mining-stress change curves of each measuring point on the two sides of the 14,301-track roadway in the process of mining the tested working face. Additionally, there were four stages: rapid rise, uniform growth, rapid rise to the peak, and rapid decline. Maximum stress monitored by the second station was 18.5 MPa, and the influence range of stress was over 140 m. Maximum stress monitored by the first measuring station was 19 MPa, the influence range of stress was about 80 m, and the peak stress position was about 20 m in front of the coal wall. Rig-site utilization proved the design of the CS-FBG borehole stress meter to be reasonable. Performance was stable and reliable, and the successful operation of field monitoring achieved the expected effect

    Isolation, Purification, Identification and Quantum Chemical Characterization of Blood Glucose-Regulating Peptides Derived from Dry-Cured Ham of Wanzhe Spotted Pigs

    Get PDF
    To investigate the inhibitory mechanism of small peptides on carbohydrate digestion, α-amylase and α-glucosidase inhibitory fractions from the water extract and the gastropancreatic digest of dry-cured ham muscle of Wanzhe spotted pigs were separated, purified, identified, and screened for peptide sequences. And the quantum chemical calculation was used to calculate structural and charge parameters including the distribution and energy of the frontier orbitals, electrostatic charge distribution and bond length, in order to speculate the active sites. It was found that the particle size of ham muscle decreased and its hypoglycemic activity increased after proteolysis. Two (S-I and S-II) and three fractions (WY-I, WY-II and WY-III) were obtained from the water extract and the digest after Sephadex column chromatography, respectively. Using mass spectrometry, 104 peptide sequences consisting of 8–24 amino acids were identified from fraction WY-II and five sequences with Peptide Ranker scores greater than 0.7 were selected. The highest occupied orbitals of the five sequences were mainly distributed in the guanidine groups of arginine and the groups close to the amino-terminal end, while the lowest unoccupied orbitals were in the carboxyl terminals and nearby groups. Sequences with lower ΔEL-H values, GPMGPSGPR, LGFGGPSGPNAGR and APAPAPAPAPPK, might be more active. According to Coulomb’s law, the active sites of these three peptides were located at –C106H108 of arginine, –C10H12 of leucine and –C176H177 of lysine, respectively. This study could provide theoretical support for understanding the blood glucose-regulating mechanism of peptides and the nutritional value of local pig breeds

    Association of modifiable lifestyle with colorectal cancer incidence and mortality according to metabolic status: prospective cohort study

    Get PDF
    BackgroundMetabolic syndrome has been linked to an increased risk of colorectal cancer (CRC) incidence and mortality, but whether adopting a healthy lifestyle could attenuate the risk of CRC conferred by metabolic syndrome remains unclear. The aim of the study is to investigate the individual and joint effects of modifiable healthy lifestyle and metabolic health status on CRC incidence and mortality in the UK population.MethodsThis prospective study included 328,236 individuals from the UK Biobank. An overall metabolic health status was assessed at baseline and categorized based on the presence or absence of metabolic syndrome. We estimated the association of the healthy lifestyle score (derived from 4 modifiable behaviors: smoking, alcohol consumption, diet, physical activity and categorized into “favorable,” “intermediate”, and “unfavorable”) with CRC incidence and mortality, stratified by metabolic health status.ResultsDuring a median follow-up of 12.5 years, 3,852 CRC incidences and 1,076 deaths from CRC were newly identified. The risk of incident CRC and its mortality increased with the number of abnormal metabolic factors and decreased with healthy lifestyle score (P trend = 0.000). MetS was associated with greater CRC incidence (HR = 1.24, 95% CI: 1.16 – 1.33) and mortality (HR = 1.24, 95% CI: 1.08 – 1.41) when compared with those without MetS. An unfavorable lifestyle was associated with an increased risk (HR = 1.25, 95% CI: 1.15 – 1.36) and mortality (HR = 1.36, 95% CI: 1.16 – 1.59) of CRC across all metabolic health status. Participants adopting an unfavorable lifestyle with MetS had a higher risk (HR = 1.56, 95% CI: 1.38 – 1.76) and mortality (HR = 1.75, 95% CI: 1.40 – 2.20) than those adopting a favorable healthy lifestyle without MetS.ConclusionThis study indicated that adherence to a healthy lifestyle could substantially reduce the burden of CRC regardless of the metabolic status. Behavioral lifestyle changes should be encouraged for CRC prevention even in participants with MetS

    Self-powered on-line ion concentration monitor in water transportation driven by triboelectric nanogenerator

    Get PDF
    The final publication is available at Elsevier via https://doi.org/10.1016/j.nanoen.2019.05.029. © 2019. This manuscript version is made available under the CC-BY-NC-ND 4.0 license http://creativecommons.org/licenses/by-nc-nd/4.0/Ion concentration in water is a key criterion for evaluating water quality. In this work, we developed a self-powered on-line ion concentration monitor in water transportation based on impedance matching effect of triboelectric nanogenerator (TENG). A rotary disc-shaped TENG (RD-TENG) and an ion concentration sensor were fabricated based on the industrial printed circuit board (PCB) technology. Flowing water in the pipeline acts as the energy source to drive the RD-TENG and generate an open-circuit (Voc) of 210 V. The ion concentration sensor exhibits a nearly pure resistance characteristic under the alternating current (AC) signal with the frequency below 500 Hz, corresponding to the rotation speed of 250 rpm for the RD-TENG. The impedance matching relationship between the RD-TENG and the ion concentration sensor was experimentally studied and applied to elucidate the sensing mechanism. Finally, a self-powered sensing system integrated with an alarm circuit was assembled which exhibits excellent responsibility and high sensitivity. The change of ion concentration with only 1 × 10−5 mol/L can light up an alarm LED.Natural Science and Engineering Research CouncilCanada Research ChairsNational Natural Science Foundation of China, no. 61804103National Key R&D Program of China, no. 2017YFA0205002Natural Science Foundation of the Jiangsu Higher Education Institutions of China, no. 18KJA535001, no. 14KJB150020Natural Science Foundation of Jiangsu Province of China, no. BK20170343, no. BK20180242China Postdoctoral Science Foundation, no. 2017M610346Collaborative Innovation Center of Suzhou Nano Science & TechnologyPriority Academic Program Development of Jiangsu Higher Education Institutions (PAPD)111 Projec

    Gender-specific association between the regular use of statins and the risk of irritable bowel syndrome: A population-based prospective cohort study

    Get PDF
    Introduction: In addition to lipid-lowering effects, statins might modulate the gut microbiome and alleviate systematic inflammation, which in turn, may have a protective effect against irritable bowel syndrome (IBS). The aim of our study was to evaluate the gender-specific association between statin exposure and the risk of IBS.Method: We undertook a prospective analysis based on the United Kingdom Biobank, a large ongoing cohort including 477,293 participants aged 37–73 years. We included participants based on information on their personal statin use and also those free of IBS and cancer at the baseline. We evaluated the gender-specific hazard ratio (HR) and 95% confidence interval (CI) with Cox proportional hazards regression, adjusting for demographic factors, lifestyle factors, comorbidities, and statin indications.Result: A total of 438,805 participants (206,499 males and 232,306 females) were included in the analysis. Among male participants, the regular use of statins was associated with a decreased risk of IBS (HR: 0.77; 95% CI: 0.61–0.97). This association persists across multiple sensitivity and subgroup analyses and did not show clear evidence of variance among the major types of statins. We did not find sufficient evidence of the association between the statin use and IBS risk in females (HR: 0.98; 95% CI: 0.82–1.16).Conclusion: Our study found that the regular use of statins was associated with a decreased risk of IBS in male participants. Further studies are required to confirm the beneficial effect of statins
    corecore